I’m working on an app that stores some information inside an SQLite DB.
My problem is that I’d like to clear all data from the database when the app gets killed or the phone restarted.
Does anybody know I can I do this?
Thanks
Marco
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There probably isn’t a totally foolproof way of doing this. You could clear the data in onDestroy() of your activity, though it might not get called if someone uses something like a task killer (pretty sure about this).
A better option would be to clear the data the next time you start the app.