Vaibhav Jain
Vaibhav Jain

Reputation: 187

How to delete application folder on uninstalling the app

When i install my app some folders are created in external storage .At the time of uninstalling the app i need to delete all these folders.

I have tried Broadcast Receiver PACKAGE_REMOVED but it does not work

Upvotes: 0

Views: 946

Answers (1)

programmer23
programmer23

Reputation: 543

Its not possible to detect when the app is uninstalled. What PACKAGE_REMOVED does is detect when OTHER apps are uninstalled, not your app.

If you want to save files on external directory and these files be removed on uninstall the app, you should use Context.getExternalFilesDir() and the files will be removed automatically (only API 8 or higher)

Upvotes: 1

Related Questions