Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Need consistent deviceID - deviceID and permanentID are inconsistent
Started by troylyndon Jan 31 2015 11:09 AM

14 replies to this topic
deviceid permanentid

Best Answer troylyndon , 03 February 2015 - 02:59 PM

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 :)

[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

troylyndon

[GLOBAL: userInfoPane.html]
troylyndon
  • Contributor

  • 564 posts
  • Corona SDK

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!



[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,493 posts
  • Corona SDK

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.



[TOPIC: post.html]
#3

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,493 posts
  • Corona SDK

One more note.  I found a bit of code over on Stack Overflow that 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'


Edited by roaminggamer, 31 January 2015 - 12:11 PM.


[TOPIC: post.html]
#4

ojnab

[GLOBAL: userInfoPane.html]
ojnab
  • Contributor

  • 546 posts
  • Corona SDK

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



[TOPIC: post.html]
#5

troylyndon

[GLOBAL: userInfoPane.html]
troylyndon
  • Contributor

  • 564 posts
  • Corona SDK

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.

[TOPIC: post.html]
#6

ojnab

[GLOBAL: userInfoPane.html]
ojnab
  • Contributor

  • 546 posts
  • Corona SDK

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.



[TOPIC: post.html]
#7

troylyndon

[GLOBAL: userInfoPane.html]
troylyndon
  • Contributor

  • 564 posts
  • Corona SDK

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?



[TOPIC: post.html]
#8

ojnab

[GLOBAL: userInfoPane.html]
ojnab
  • Contributor

  • 546 posts
  • Corona SDK

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.



[TOPIC: post.html]
#9

troylyndon

[GLOBAL: userInfoPane.html]
troylyndon
  • Contributor

  • 564 posts
  • Corona SDK

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.



[TOPIC: post.html]
#10

troylyndon

[GLOBAL: userInfoPane.html]
troylyndon
  • Contributor

  • 564 posts
  • Corona SDK

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.



[TOPIC: post.html]
#11

ojnab

[GLOBAL: userInfoPane.html]
ojnab
  • Contributor

  • 546 posts
  • Corona SDK

Have you tried system.getInfo("iosIdentifierForVendor") ?



[TOPIC: post.html]
#12

troylyndon

[GLOBAL: userInfoPane.html]
troylyndon
  • Contributor

  • 564 posts
  • Corona SDK

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



[TOPIC: post.html]
#13

ojnab

[GLOBAL: userInfoPane.html]
ojnab
  • Contributor

  • 546 posts
  • Corona SDK

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.



[TOPIC: post.html]
#14

troylyndon

[GLOBAL: userInfoPane.html]
troylyndon
  • Contributor

  • 564 posts
  • Corona SDK

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



[TOPIC: post.html]
#15

troylyndon

[GLOBAL: userInfoPane.html]
troylyndon
  • Contributor

  • 564 posts
  • Corona SDK

  Best Answer

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 :)




[topic_controls]
[/topic_controls]