Android: How to reset FirstRun SharedPreferences when my app is updated?

后端 未结 4 1222
盖世英雄少女心
盖世英雄少女心 2020-12-14 04:14

My app copies files over from res/raw to the sdcard on first run. I want it to update those files on every subsequent app update. How can i have it reset the firstrun prefer

4条回答
  •  一向
    一向 (楼主)
    2020-12-14 04:41

    You could mimic what's done on the database side, with version numbers. Instead of having just a firstRun variable, have a couple with firstRun and versionNumber, and put a static version number field in your app, that you increment at each release. This way, you'll be able to check if the app has been updated, and do your operation on each update.

提交回复
热议问题