Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete a folder when user selects uninstall my application in android

I would like to know about how to delete a folder once user select uninstall button for my application. I want it by programmatically is there any chance to do it... If so let me know possible solution for it. thanks in advance.

like image 295
Shekhar Avatar asked Apr 20 '11 04:04

Shekhar


1 Answers

If you created any folders on a device's external storage... there is no way for you to call code when the user uninstalls your app. Certain things are removed automatically (databases, anything written to Internal Storage), but not folders on external storage.

EDIT - As pointed out by Stephan, if you are targeting API Level 8 or higher, you can use Context.getExternalFilesDir() for your external files and those will be removed on uninstall.

like image 119
Maximus Avatar answered Nov 13 '22 18:11

Maximus