How to reset an application states when upgrading from the market

一个人想着一个人 提交于 2019-12-11 07:43:00

问题


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 ?


回答1:


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.



来源:https://stackoverflow.com/questions/7077988/how-to-reset-an-application-states-when-upgrading-from-the-market

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!