how to delete a file's on uninstall the android application? [duplicate]

耗尽温柔 提交于 2019-12-24 02:53:04

问题


Possible Duplicate:
How to delete files created by the application on uninstall?

we have a made a streaming media player in android. in my application send a event file in every 15 min to over server. may be some of the file store in phone memory.

how to delete all file when application uninstall??

please help me out.

Thanks


回答1:


If it's stored on SD card:

If you're using API Level 8 [Android 2.2] 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.

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

Files in the directory /data/data/app.package.name (internal storage) will be removed on uninstall as mentioned in Android - Preserve or delete files created by the application on uninstall



来源:https://stackoverflow.com/questions/4977351/how-to-delete-a-files-on-uninstall-the-android-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!