4

I need some guidance about device identification.

Case is as follows: There will be a game application both for iOS and Android. users will play it without registration step. There will be in app purchase content of game lives, in packs of 3, 5 and 10. (Consumable In app purchase) Now, what I would like to do is to store which device has how many lives on my database with deviceid - remaininglives pair. I want to keep the values on app reinstalls and restore them, however on factory reset, I want these values to be re-set.

So, for iOS I will be using identifierForVendor and store it in keychain. This way this id will be unique in each device and it will be same as long as device does not get re-set. So, even if user deletes the app and installs it, he will still have the game lives he purchased before uninstall.

However, for Android I cannot find a good solution. I think of

  • Using Secure.Settings.ANDROID_ID ; But as we saw in dozens of other stackoverflow posts, this is not reliable in many of devices. Some prints same id for all models, some return null and etc.
  • Generating UUID randomly at app startup ; This would give me a unique id PER INSTALLATION. It is unique but it does not cover the case of reinstall
  • Generate an id depending on values MODEL, SERIAL, MANUFACTURER ; I doubt this id will be unique, so this is not a preferable solution as it may mess things up in case of a duplicate id.

Is there any clean solution for android like the iOS one? Thanks

Can Gokdere
  • 286
  • 3
  • 12
  • It seems to be a duplicate of: http://stackoverflow.com/questions/14657977/android-is-there-an-equivalent-to-identifierforvendor-in-ios – Eduardo Jan 11 '16 at 01:22

0 Answers0