Android clean up after dirty Shutdown
<p>I am writing a program which creates various files during operation, and on closing the Activity will remove curtain files and register others in the database.</p>

<p>is there a way to detect when next running the program if the application is was not closed properly (ie if the battery was removed) in order to run a clean-up and fix the database.</p>

<p>I would run it every time however I think it could get quite time consuming.
When necessary the clean-up should be run before staring the main activity (not the one that normally does the clean-up) as it affects the output.</p>

<p>I have code for this clean-up, and am using API 10. </p>
