简体   繁体   English

警告Android用户,应用程序更新可能导致旧应用程序版本丢失数据?

[英]Warning Android user that app update could lead to losing data from old app version?

I'm writing a game for Android. 我正在为Android编写游戏。 When the user completes a level, they can restart from the next level if they lose (ie I need to store an integer to remember which level they got to). 当用户完成一个级别时,如果他们输了,他们可以从下一个级别重新开始(即,我需要存储一个整数以记住他们到达的级别)。 If the app is interrupted during play, I save the world state to disk (this is complex state storing a map and game entities). 如果应用在播放过程中中断,我会将世界状态保存到磁盘(这是存储地图和游戏实体的复杂状态)。

I'd like to keep my options open in the future for changing my game code and the way the world state is saved/stored. 我想将来保留我的选项,以更改游戏代码以及保存/存储世界状态的方式。 However, I must consider the scenario when a user has an old version of the world state on their phone because they were in the middle of a game, they upgrade the app and now the app cannot load the world state. 但是,我必须考虑以下情况:用户在手机中拥有旧版本的世界状态,因为他们正在玩游戏,他们升级了应用程序,现在应用程序无法加载世界状态。

Having to write code to migrate the old version of the data to the new version of the data would be a pain if there's some way I can avoid this. 如果有某种方法可以避免这种情况,那么不得不编写代码将旧版本的数据迁移到新版本的数据将很痛苦。 It would be nice if I could somehow ask the user to finish their current game in progress before updating. 如果我能以某种方式要求用户在更新之前完成他们当前的游戏,那就太好了。 Can this be done? 能做到吗? Are there any other options? 还有其他选择吗?

I don't intend to do this often. 我不打算经常这样做。 I'd like to iteratively develop my game while getting some early feedback, but this is difficult if I must fix how the world state is saved and restored now. 我想迭代开发自己的游戏,同时获得一些早期反馈,但是如果我必须确定现在如何保存和恢复世界状态,这将很困难。

I hope this doesn't seem a silly question, but on a PC or a console it's perfectly OK to have games that you cannot save during a game or you can only save between levels. 我希望这似乎不是一个愚蠢的问题,但是在PC或游戏机上,拥有无法在游戏中保存或只能在关卡之间保存的游戏是完全可以的。 I'm just finding Android a bit of a pain here as you must have a save game strategy for all games. 我在这里发现Android有点痛苦,因为您必须为所有游戏制定保存游戏策略。

You cannot prevent a user from upgrading an app, and you cannot execute any code until your app is installed (or upgraded). 您不能阻止用户升级应用程序,并且在安装(或升级)应用程序之前不能执行任何代码。

Quite frankly, losing data due to an upgrade is unacceptable. 坦率地说,由于升级而丢失数据是不可接受的。 If you use an SQLiteOpenHelper, you automatically get nice hooks that help you with the upgrade process. 如果您使用SQLiteOpenHelper,则会自动获得漂亮的挂钩,以帮助您进行升级。

I understand that you have a pretty complex savegame setup, but try to keep it as flexible as possible to allow for easy upgrades. 我了解您有一个非常复杂的存档游戏设置,但请尝试使其尽可能保持灵活性以方便升级。 There are lots of techniques that help you with that. 有很多技术可以帮助您。

And Android and PCs are just completely different - on a PC, you sit down and play for hours. Android和PC完全不同-在PC上,您要坐下来玩几个小时。 On Android, you play real quick and then do something else. 在Android上,您可以快速玩游戏,然后再执行其他操作。 Or, you play and get a phone call and are forced to switch away from your game. 或者,您玩游戏并接到电话,被迫退出游戏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果当前版本 &lt;&gt; 市场版本,则提示 Android 应用用户更新应用 - Prompt Android App User to Update App if current version <> market version 应用更新从内部存储中删除旧的共享首选项数据 - App update deletes old shared prefs data from internal storage 从android中的另一个应用程序更新一个应用程序的数据库 - update database of an app from another app in android 应用程序版本更新后,我可以在哪里存储用户数据以保留这些数据? - Where I can store user data to keep these after an app version update? 您能否在用户更新到 Google Play 商店中您的应用程序的最新版本之前向他们发出警告? - Can you issue a warning to users before they update to the latest version of your app in the google play store? Android 使用数据库值更新应用程序视图 - Android App update view with value from database 如何从parse.com中用于Android应用程序的管理员用户更新多个用户 - How to update multiple users from an administrator user in parse.com for android app 如果有新的应用版本可用,如何触发更新 ( FROM GITHUB ) - How to trigger update if the new app version is available ( FROM GITHUB ) 如何从android中的应用程序注销用户 - How to signout a user from the app in android 根据 Android App 中的用户输入制作表格 - Make a table from user input in Android App
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM