I am facing this problem that, when I uninstall my app folder still available in the sdcard path,
What should I do to remove it ?
please suggest something to make it happen ...
What should I do to remove it ?
Use getExternalFilesDir()
and/or getExternalCacheDir()
for your files on external storage ("sdcard"). Those directories are automatically removed when your app is uninstalled.
Beyond this, nothing else is possible, as you do not get control when your app is removed.
Unfortunately, in simple words, the answer is: no, you can't.
You need to broadcast, that you can listen when you app is Uninstalled. but the application which is going to be uninstall won't get any broadcast for its uninstall.
If you created any folders on a device's external storage there is no way for you to call code when the user uninstall your app.
Only way to do that is If you use getExternalCacheDir()
, then only folders auto deleted when uninstalling the application.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With