Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android:How to remove the folder in the sdcard

Tags:

android

My app creates a folder in the sdcard. I wanna remove the folder when the app is uninstalling or when the app is notified to be uninstalled. Is anyway to make it?? Thanks in advance!!

like image 420
Rocky Avatar asked Nov 22 '25 11:11

Rocky


2 Answers

use getExternalFilesDir() to get a directory on the SDCard that will be deleted when your app gets uninstalled.

http://developer.android.com/guide/topics/data/data-storage.html#filesExternal

like image 112
SimonSays Avatar answered Nov 24 '25 04:11

SimonSays


Android at the moment does not give you a possibility to perform code at the moment your app is uninstalled.

All the settings that are set via the SharedPreferences are deleted together with everything in the Aplication Data an Cache folder.

The only thing that will persist is the data that is written to the SD-Card and any changes to phone settings that are made.

like image 25
Chirag Avatar answered Nov 24 '25 03:11

Chirag