Uninstalling APK : one last action before uninstall

老子叫甜甜 提交于 2020-01-02 02:53:12

问题


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)


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/7027187/uninstalling-apk-one-last-action-before-uninstall

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!