开发者

Android game: High scores

I'd like to have my And开发者_如何学编程roid game keep track of global high scores.

To do this, there needs to be some unique identifier for each user in the SQL table on my server.

My question is, what does the Android SDK offer as far as this goes?

Is Settings.Secure.ANDROID_ID my best bet?


Do not use Secure.ANDROID_ID

You will find a very high number of 2.1 or below phones, as well as most emulators and custom ROMs all have the same ID: 9774d56d682e549c

Test for this value, then use secondary identification measures... or just skip it and use UUID


ANDROID_ID is not guaranteed to be unique. I would suggest having your user specify a name of their own, and as long as the name has not already been registered on your server, they get it - end of story. If you want to give them the ability to retain the name over device wipes / transfers, then you can allow them to specify a password as well, but strictly speaking it probably isn't necessary for a game high score recorder.


You could always try generating a UUID for the user if they don't have one assigned to them.


If you're still looking for a solution, Swarm's Leaderboards system looks like a good match. Provides a simple solution for adding customizable leaderboards to games, and is pretty easy to work with.


I know it is a late response but maybe it will help someone who still will read this post. Actually this is a good thread discussing unique android id: Is there a unique Android device ID?

The solution many developers use is retrieving the unique android id the standard way:

Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);

or

Settings.System.getString(context.getContentResolver(), Settings.System.ANDROID_ID);

And if the last one is not present use other device unique parameters like IMEI, WIFI MAC, etc...

If you don't want to implement the leaderboard and social layer from scratch, we would be glad to help you integrating our Skiller SDK ;)

I am ofcourse from Skiller, for the full disclosure.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜