I wanted to delete a image Folder created by App from image gallery when user uninstall App.Any one know how to do this programmatically?
Asked
Active
Viewed 724 times
0
-
Put your files in directories that are automatically removed upon uninstall, such as `getExternalFilesDir()`. – CommonsWare Nov 04 '15 at 14:46
-
would you describe more with coding? or any reference @CommonsWare – Ahmad.Aslam90 Nov 04 '15 at 14:48
-
1http://developer.android.com/reference/android/content/Context.html#getExternalFilesDir%28java.lang.String%29 – CommonsWare Nov 04 '15 at 14:49
-
i have a limitation can't create a private or external files directories due to company requirements would you suggest me other solution regarding SD card data clean up? @CommonsWare – Ahmad.Aslam90 Nov 04 '15 at 15:19
-
1"i have a limitation can't create a private or external files directories" -- then the file does not exist, and so there is nothing to clean up. "would you suggest me other solution regarding SD card data" -- you have no ability to write to removable media. Hence, the file does not exist, and so there is nothing to clean up. Your best option appears to be to not have the file on the device at all, and download it when needed. – CommonsWare Nov 04 '15 at 15:26
-
If you can't create folders then how is there anything to clean up? – JB King Nov 04 '15 at 17:07
1 Answers
0
There is no way to detect that your OWN app is being uninstalled. It's a security issue. But other applications can. Receiving package install and uninstall events
Perhaps it's possible to create a separate application, that can listen to that event and remove the folder and then uninstall itself Implicit intent to uninstall application?