Detect if my application is uninstalled

Is it possible to have a code that detects that my application has been uninstalled, and when deleted, all the corresponding folders created by my application will be automatically deleted?

Thanks!

+4
source share
3 answers

Thanks for all your decisions! At least I know that my application cannot detect deletion.
But I solved the problem of deleting all the corresponding folders created by my application by placing the corresponding folders in the context.getExternalFilesDir(null).getAbsolutePath() folder
Everytime Android uninstall ur, and it will delete everything in the /mnt/sdcard/Android/data/com.yourapp.com folder.
context.getExternalFilesDir(null).getAbsolutePath(); put the ur folders inside the /mnt/sdcard/Android/data/com.yourapp.com folder.

0
source

Regarding the possibility of detecting Uninstall, I am afraid that this is impossible.

Whenever an application package is deleted (the application is deleted), an ACTION_PACKAGE_REMOVED intent will be sent to all EXCEPT recipients for yours.

From the documents: -

Broadcast: An existing application package is removed from the device. The data contains the package name. the package that is installed does not receive this intention.

This is confirmed here .

+5
source

No, you cannot verify that your application will be deleted.

But you can create your own folder in your cache so that when you uninstall the application all folders and files are automatically deleted.

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

+1
source

All Articles