1

As a developer, I have applications already published on the market. When users download the new version, I want the application to clean its states ( SharedPreferences , SQLite schema ... ). I read about SQLiteOpenHelper. I suppose when I'm loading a new .apk on the device from Eclipse, the app still keeps its previous SharedPreferences . If the DB schema changed, the app will crash.

Is it possible to trigger a "clean states" when the application is being upgraded from the market ?

2
  • Totally agree with @onik, but to be honest, there should be no reason why you couldn't migrate or "upgrade" shared preferences along with the database.
    – RivieraKid
    Aug 16, 2011 at 14:51
  • @ RivieraKid Thanks for migrating this question. As a new user on Android exchange, I could not delete it. But I opened a similar on SO stackoverflow.com/questions/7076622/… . BTW I ask how to reset every states not just the database or SharedPreferences. – raychenon Aug 17, 2011 at 9:21

1 Answer 1

3

To your question, you should be able to trigger a database update using SQLiteOpenHelper OnUpgrade (change DATABASE_VERSION in your class) and either call a function from there to clear the preferences or add a flag to the db for this and do it in your main program.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.