I'm writing an app that allows the user to make a photo and then do some work with it.
I launch the camera with an IMAGE_CAPTURE intent, and provide a path to have the photo saved there.
This photo is temporary and I want to delete it when my app finishes.
I have an activity where I show the photo and allow the user to interact with it, and I thought the best way to delete it was on the onDestroy method.
The problem I am having is that when the user changes the orientation of the device, the activity is destroyed and replaced by a new one, but I cannot delete the file just because the user changes orientation as it is needed later on.
So, what can I do for keeping these files deleted?
Is there any other method i can overwrite, such as onAppExit, where I can delete all my temp files?
thanks in advance