Detect if my app is uninstalled

好久不见. 提交于 2019-12-04 12:49:16

Regarding being able to detect the Uninstallation, I'm afraid its not possible.

Whenever an application package is removed(App is Uninstalled), ACTION_PACKAGE_REMOVED intent will be sent out to all receivers EXCEPT for your own.

From the docs:-

Broadcast Action: An existing application package has been removed from the device. The data contains the name of the package. The package that is being installed does not receive this Intent.

This is confirmed here.

No dear you cant check that your application is going to uninstall.

But you can create your folder in your cache dir so that when your application will be deleted all folders and files automatically will be deleted.

Please check it. http://developer.android.com/guide/topics/data/data-storage.html

Thanks for all your solutions! At least I know now my app cannot detect an uninstall.
But I have solved the problem of removing all the relevant folders that my app has created by placing relevant folders in: context.getExternalFilesDir(null).getAbsolutePath()
Everytime Android uninstall ur app, it will delete everything in the /mnt/sdcard/Android/data/com.yourapp.com folder.
context.getExternalFilesDir(null).getAbsolutePath(); put ur folders inside the /mnt/sdcard/Android/data/com.yourapp.com folder.

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