Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity 4.2 SystemInfo.deviceUniqueIdentifier regression

Discussion in 'Editor & General Support' started by Alexey, Aug 2, 2013.

  1. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,623
    We found out that we broke SystemInfo.deviceUniqueIdentifier in 4.2 (it will return values different from before)
    you need to change Unity/DeviceSettings.mm:
    change
    CC_MD5(macaddr_str, sizeof(macaddr_str), hash_buf);
    to
    CC_MD5(macaddr_str, sizeof(macaddr_str)-1, hash_buf);
     
  2. jvil

    jvil

    Joined:
    Jul 13, 2012
    Posts:
    263
    I'm a little confused about SystemInfo.deviceUniqueIdentifier as doc says it is guaranteed to be unique for every device.

    It's the equivalent to Settings.Secure.ANDROID_ID on Android? Or it's another identifier that Unity generates? Because with ANDROID_ID there has been at least one widely-observed bug in a popular handset from a major manufacturer, where every instance has the same ANDROID_ID, so can't be guaranteed to be unique for every device. Also, it is not 100% reliable on releases of Android prior to 2.2.

    Anyone can clarify this deviceUniqueIdentifier for Android?

    Thanks!
     
  3. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,623
    this is a post about ios ;-)
    but regarding android - we use hash of mac addr, and check android_id only if there is no permission to access telephony
     
  4. skullthug

    skullthug

    Joined:
    Oct 16, 2011
    Posts:
    202
    Sorry to hijack this back to Android, but I'm having difficulty getting SystemInfo.deviceUniqueIdentifier to default to displaying android_id. I have a custom AndroidManifest.xml that has the phone permission removed, but it keeps getting re-added (I'm assuming by Unity) automatically when I build. Removing the call to SystemInfo.deviceUniqueIdentifier removes the permission from being auto-added.

    Does Android_ID only occur if the device is not a phone and thus cannot get permission? There's so little documentation on this :(