我正在开发一款游戏,如果用户赢得比赛,我需要存储当前分数以添加新分数。 看谷歌的游戏样本,我发现此评论:Android加密文件存储游戏得分
public void saveLocal(Context ctx) {
/* TODO: This is left as an exercise. To make it more difficult to cheat,
* this data should be stored in an encrypted file! And remember not to
* expose your encryption key (obfuscate it by building it from bits and
* pieces and/or XORing with another string, for instance). */
}
它们存储在本地得分点,那么他们点添加到这个局部变量上传在排行榜上的新成绩。
实现此功能的任何示例? 有没有更好的方法来做到这一点?
我正在使用此库存储它:https://github.com/orhanobut/hawk/tree/hawk1 –
库本身看起来不错。我仍然没有存储得分的确切值,但是像一个补充值(在java中用〜VARIABLE完成)。记得检查有关加密的出口法律。 – Ch4t4r
但我有一个新问题,如果用户按“从这个应用程序删除数据”再见我的本地存储 –