PDA

View Full Version : How to remove widget when the app is uninstalled in Android?



angel999
08-10-2011, 04:04 AM
In Android, I have created a widget for my application. When I uninstall the app, the widget shows "problem loading widget" error in home screen. I need a scenario where widget should be removed by the developer through code (and not by the drag and drop to the trash) when I uninstall the app. Is it possible? If so, what changes we need to do? Is there anything that can be set in the manifest so that it removes all references of the app once it is uninstalled? :android-question::android-question:

angel999
08-10-2011, 04:10 AM
I have already debugged on Phone and emulator, I realize that when we uninstall our app, only activity manager of phone is run. I don't know how to catch event uninstall app. Some people who Pro Android, please help me!!!.Thank so much.

furbearingmammal
08-10-2011, 06:39 PM
Threads merged and moved to Beginning Developers forum as this appears to be a development question.

Please do not dupe-post or cross-post.

alostpacket
08-18-2011, 05:47 PM
There is no way for an app to catch it's own uninstall event. There likely will not ever be a way, as that's a big security risk.

Also I am not sure if it is possible to removed a widget programatically when uninstalled. But I dont think so :(

Sorry for the bad news :(

titanoman
08-19-2011, 01:13 AM
Threads merged and moved to Beginning Developers forum as this appears to be a development question.

Please do not dupe-post or cross-post.

Does that mean that I shouldn't ask any questions about this here? If it's okay, I would ask if the remaining widget is an example of part of an app being left on the sd card? Sorry to ask a basic question in a developers status (what I would certainly consider advanced) topic?

alostpacket
08-22-2011, 11:03 AM
What gets left behind is some setting that makes the OS think there should be a widget there. But nothing of the actual app/widget gets left behind. Just a "slot" reserved to hold it. If the user drags that to the trash it just frees space on the home screen. But by that point all the files from the app are long gone (unless the app saved some other files to the SD for some reason).

hth