开发者

Android - Remove data from SDCard

开发者 https://www.devze.com 2022-12-28 12:01 出处:网络
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

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 id开发者_Python百科eas ?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号