0

I'd like to have my Android 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?

Jesse
  • 599
  • 2
  • 9
  • 23
  • Hi @Jesse, Please check out my answer below, just now realized you may not be notified on my answer this way. Tell me what you think. – MikeL May 06 '12 at 05:20

5 Answers5

3

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

Eric
  • 1,953
  • 4
  • 24
  • 33
2

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.

mah
  • 39,056
  • 9
  • 76
  • 93
1

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.

Community
  • 1
  • 1
MikeL
  • 5,385
  • 42
  • 41
1

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

Sashi Kolli
  • 751
  • 5
  • 6
1

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.

impact
  • 396
  • 2
  • 6