Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uninstalling APK : one last action before uninstall

I'm developing an application for Android that installs stuff on the phone's sim card. What I wan't is for the application to do one last action upon uninstall : remove what's inside the sim card. Which means : I need to do one last action when my APK is uninstalled.

Problem : I didn't find any way to do so. (Apart from having a secondary application, that catches the uninstall intent, and does the job, but that's very faaaaar from what I wan't I'm afraid)

If anyone has a solution, I'm really interested.

Thanks in advance.

(PS : I'm kind of afraid that there is none, actually)

like image 941
Redwarp Avatar asked Aug 11 '11 13:08

Redwarp


2 Answers

You are correct. There is no such event, and there is no supported way to get notified when your application is being uninstalled. Application's process is simply killed (if it was running) and application is uninstalled.

like image 77
inazaruk Avatar answered Nov 19 '22 04:11

inazaruk


If you can detect if other applications are uninstalled via ACTION_PACKAGE_REMOVED, wouldn't is be possible to solve the problem if you made 2 applications? The second being a broadcastreceiver that catches the intent and then deletes content.

like image 2
kristof01 Avatar answered Nov 19 '22 05:11

kristof01