Need consistent deviceID - deviceID and permanentID are inconsistent

Please help!

Apparently, I am unable to use deviceID or permanentID as written in the API to receive any consistent value.  Let me explain.

If all you do is record the deviceID or permanentID as written in the API, then uninstall and reinstall your App, the Corona API will NOT always give the same values. It only gives the same value after it is installed.

A reinstall or a power-down or a reset all result new values - inconsistent from previous system.info (“deviceID”) or device.event for permanentID as written in the Corona API.

Because my game tracks important metrics from game data progress (to know where gamers get stuck) and scores on my server, I must have a consistent and never changing value to recognize a device - and this value must be consistent and never change from one install to the next, or from one game update to the next.

Please help!

Hi.  I’m going to weigh in briefly, and I hope that I’m wrong.  However,

  1. I assume  you’re talking about your app as released on iOS right?

  2. If so, I’m 99% sure this is not Corona’s fault.  Apple no longer allows one to gather a specific device ID any longer.  This was a new guideline back in iOS 6 I believe.

@All - Anyone reading who has a solution please chime in,  I’m just responding to help clarify that this may not be a Corona problem.

One more note.  I found a bit of code over on Stack Overflowthat indicates there are two ways to get a unique ID:

NSString \*strUniqueIdentifier = [[UIDevice currentDevice] uniqueIdentifier];

vs.

NSUUID \*oNSUUID = [[UIDevice currentDevice] identifierForVendor];

My guess is Corona is pulling the prior. e.g. ‘uniqueIdentifier’

On iOS you are not allowed to use the UDID anymore. Your app will be rejected if you use it and thats why Corona removed the possibility to retrieve it.

Now you can only use the identifierForVendor or the identifierForAdvertising. 

Both of these can be disallowed or reset by the user in the privacy settings of the device.

I guess your best chance to get a stable identifier is to use the openUDID plugin

http://docs.coronalabs.com/plugin/openudid/index.html

If I do use the open UDID plugin, are you saying the game will get rejected when submitted for publication - but for beta testing, it can be used? Or will this plugin give me an identifier which will never change on the device?

Thanks for your continued help.

A couple of years ago when apple decided to give users the option to opt out of ad tracking (which was always using the UDID) they disallowed developers to use the UDID. 

When this happened someone invented the openUDID - which is basically a hash of the MAC address - as an alternative.

Later apple came up with the advertisingId (IDFA) that users can reset and thereby limit ad tracking.

I am not 100% sure if the openUDID will never change or if apple accepts it.

But I think it is your best chance of getting a stable id.

okay. I’m 50% there with an iOS solution - thank you for the openUDID recommendation for iOS. What API to you recommend for Android to get a consistent value? deviceID changes every time the program is uninstalled and then reinstalled, so it’s not consistent. Any suggestions?

If you add the “android.permission.READ_PHONE_STATE” to your build settings the system.getInfo(“deviceId”) call will return the IMEI/MEID id for the phone. This should be consistent after reinstalls etc.

I have just verified that this solution works on Android:

 

Step 1) “android.permission.READ_PHONE_STATE” to the build settings file

Step 2) use system.getInfo(“deviceId”) to return the IMEI/MEID id for the phone.

Step 2 will not work properly without  Step 1.

Does ANYONE have any ideas about how to get a consistent identifier from an iOS device in Corona?

For iOS, I have just verified that I cannot include the openUdid plugin. When I attempt to create an iOS build on the Mac, I get the message “Unexpected build error. Error code: 5…” - the message has some nonsense about connecting directly without a proxy server, which I am not using. But I have confirmed 5 different times that removing the plugin allows the build to complete. Corona simple will not create a build with the openUdid plugin - this should be documented in the API page as no longer working.

Have you tried system.getInfo(“iosIdentifierForVendor”) ?

I will try getInfo(“iosidentifierForVendor”). I read somewhere online that it wasn’t consistent all the time. I will try and report back.

Yeah try it.

But I think you will have a hard time finding a 100% persistent id on ios, because apple want users to be able to control their privacy.

It is possible to store things in the Keychain after you retrieve them once -> if I can do that, I will have solved this.

After much research, I have realized that with iOS 6, Apple introduced two new properties in the UIDevice family, similar in nature to the “deprecated” UDID.  That’s right, Apple will no longer allow anyone to use the UDID. Even though the open source OpenUDID solution which was implemented by Corona is no longer supported - I get a Build error #5 in Corona now.

The two new similar options to use are:

  1. system.getInfo(“identifierForVendor”) – this option is supported by Corona and is the only option for iOS determination for NON-ADVERTISING companies.

  2. in thte ASIdentifierManager class, identifierForAdvertising is the best option - but misuse of it will likely cause relationship problems with Apple. Misuse is defined as using this identifier for reasons OTHER than ad tracking like using the ID to keep track scores, levels, and other app user behaviors - which is now greatly discouraged by Apple.

In summary, #1 is the best Corona option. From the time a developer’s app is first installed, the IdentifierForVendor will not change so long as that device always has at least one app installed by a given developer. If uninstalled however, and then reinstalled, a new identifierForVendor value will appear - nothing can be done to get around this without risking big problems with Apple, period the end.

If you benefited from my research, please let me know and encourage me to continue to post my results when other Forum users don’t know the answers. Thank you :slight_smile:

Hi.  I’m going to weigh in briefly, and I hope that I’m wrong.  However,

  1. I assume  you’re talking about your app as released on iOS right?

  2. If so, I’m 99% sure this is not Corona’s fault.  Apple no longer allows one to gather a specific device ID any longer.  This was a new guideline back in iOS 6 I believe.

@All - Anyone reading who has a solution please chime in,  I’m just responding to help clarify that this may not be a Corona problem.

One more note.  I found a bit of code over on Stack Overflowthat indicates there are two ways to get a unique ID:

NSString \*strUniqueIdentifier = [[UIDevice currentDevice] uniqueIdentifier];

vs.

NSUUID \*oNSUUID = [[UIDevice currentDevice] identifierForVendor];

My guess is Corona is pulling the prior. e.g. ‘uniqueIdentifier’

On iOS you are not allowed to use the UDID anymore. Your app will be rejected if you use it and thats why Corona removed the possibility to retrieve it.

Now you can only use the identifierForVendor or the identifierForAdvertising. 

Both of these can be disallowed or reset by the user in the privacy settings of the device.

I guess your best chance to get a stable identifier is to use the openUDID plugin

http://docs.coronalabs.com/plugin/openudid/index.html

If I do use the open UDID plugin, are you saying the game will get rejected when submitted for publication - but for beta testing, it can be used? Or will this plugin give me an identifier which will never change on the device?

Thanks for your continued help.

A couple of years ago when apple decided to give users the option to opt out of ad tracking (which was always using the UDID) they disallowed developers to use the UDID. 

When this happened someone invented the openUDID - which is basically a hash of the MAC address - as an alternative.

Later apple came up with the advertisingId (IDFA) that users can reset and thereby limit ad tracking.

I am not 100% sure if the openUDID will never change or if apple accepts it.

But I think it is your best chance of getting a stable id.