2

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

Community
  • 1
  • 1
milind
  • 960
  • 4
  • 12
  • 38
  • Also see http://stackoverflow.com/questions/2874412/get-application-uninstall-event-in-android – Eugene Mayevski 'Callback Feb 12 '11 at 09:38
  • The application `NQ Mobile Security` is calling an Activity at uninstall look at the http://i.imgur.com/Fos9N.png, http://i.imgur.com/fIZbK.png, http://i.imgur.com/cG9Hr.png and the question http://stackoverflow.com/questions/10219328/how-to-show-an-activity-before-my-app-is-uninstalled-android – Gaurav Agarwal Jun 16 '12 at 10:21

1 Answers1

5

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

Community
  • 1
  • 1
Floern
  • 33,559
  • 24
  • 104
  • 119