2

I'm building an Android game and I'm not sure where I should save something like "last completed level" or "remaining lives".

I'm pretty sure that I should not save this information in the database, because it's really simple to access an app's database with root access and some SQLite browser. And I don't want to send it to a webserver, because the game should be playable offline.

What is the most secure place where I can store this information to prevent the player from cheating?

Thanks in advance

Patrick Zinner
  • 356
  • 4
  • 17
  • 1
    So what if the player cheats on his own device, in an offline game? – laalto Mar 12 '14 at 12:09
  • [Similar](http://stackoverflow.com/q/12670282/2345913).... how about encrypting the data and then storing them – CRUSADER Mar 12 '14 at 12:12
  • @laalto the point is, that I am thinking about creating a highscore table on the server. The game itself should be playable offline on the phone, but you should still be able to share your highscore afterwards. But still, if I don't implement such features: I just don't like cheaters / cheating :P – Patrick Zinner Mar 12 '14 at 12:17

3 Answers3

2

You may wanna try one of the three options described here : http://developer.android.com/training/articles/security-tips.html

Since android is base on UID, it is almost impossible to prevent root user to retrieve data, but you can still encrypt it .

I would go for the internal storage with encryption, and skip the content provider option due to the few data you will store

Morendo
  • 752
  • 1
  • 4
  • 23
2

You could use a non secure storage (like SharedPreferences for example) but use a digital signature to make sure that the value wasn't tampered with.

Tom Susel
  • 3,397
  • 1
  • 24
  • 25
0

So you can use Cipher to save your game information file
check this https://stackoverflow.com/a/10782267/2773264

or you can save your file as Object by using ObjectOutputStream (don't save String Object, save a custom class to prevent from cheating).

Community
  • 1
  • 1
Smile
  • 375
  • 1
  • 3
  • 13