0

i Want to delete a folder when application is closed or uninstalled.
automatically folder could be delete when application is close. is there any function available in android. I already try this code the folder is delete using this code. by i want to delete a folder when application is close. so where can i put this code??

Community
  • 1
  • 1
  • if you are using to store minimal data save files in internal memory http://developer.android.com/guide/topics/data/data-storage.html#filesInternal – Ravi Gadipudi Sep 30 '15 at 07:31
  • i have a lots of data so it is not possible to store in internal storage. –  Oct 01 '15 at 10:12
  • 1
    I solved this problem by using Alarm manager. in that i find the recent apps and if our application is in recent app than we are not delete the folder. otherwise we delete the folder every 10 second i check this. –  Oct 12 '15 at 09:40

2 Answers2

0

Place file deletion code inside onDestroy() call back method of your home screen.

siva
  • 16
0

Yes finally i got the Solution of this Question.. For that i used a Alarm Manager service of Android. Alarm Manager Service repeatedly perform the task in android.

So, I call Alarm Manager Service every 10 seconds and i find the recent apps if our application is running than we are not delete the folder. otherwise we delete the folder. Alarm Manager Demo Code

From the above link you can do this. instead of notification code put your code(find recent app and delete the folder if it is not available in recent app.)