简体   繁体   中英

Android - Remove data from SDCard

My application use the SDCard to store data (about 100 Mb of stuff). I would like to delete these file when the application is deleted through the application manager and offer a way to clear the data from there (like the Google Apps does). Any ideas ?

Quote From http://developer.android.com/guide/topics/data/data-storage.html

Accessing files on external storage

If you're using API Level 8 or greater, use getExternalFilesDir() to open a File that represents the external storage directory where you should save your files. ... If the user uninstalls your application, this directory and all its contents will be deleted.

From my understanding this will create a file on the sd card which has a scope (like a directory of your applications package namespace) and the phone will delete the directory when you uninstall the app. I assume this is how Google apps achieves this function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM