Search Unity

Question about deviceUniqueIdentifier consistency?

Discussion in 'iOS and tvOS' started by kromenak, Jan 30, 2014.

  1. kromenak

    kromenak

    Joined:
    Feb 9, 2011
    Posts:
    270
    I'm trying to set up an account recovery feature in my game based on the device's UDID. I'm having some issues with deviceUniqueIdentifier and was hoping for some clarification.

    First, I noticed that on pre-iOS7 devices, the value returned by deviceUniqueIdentifier seems to always be consistent, so that's great.

    On iOS7, I'm finding that the value returned by deviceUniqueIdentifier is different for each fresh install of the game. It seems to be consistently the same value for every run of the game, but if I uninstall the game and reinstall it with XCode to test account recovery, I find that deviceUniqueIdentifier is returning a different value.

    Is this the expected behavior? I was imagining it would stay the same between installs. Is this an issue that only arises when building to device and not to the store? It seems that Unity's code is checking the VendorID before checking the AdvertisingID; would the AdvertisingID be more consistent?
     
  2. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,624
    yes, because it is the hash of the MAC (which is fixed)
    true
    not really
    please check apple docs for more information about the usage of both - we expose direct getters so you can use the one that you feel is better for you
     
  3. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey guys!

    Actually deviceUniqueIdentifier is really confusing on iOS and even may lead to your app rejection by Apple.
    As described in deviceUniqueIdentifier docs, at iOS7+ it tries to use VendorID first. As we can read out from identifierForVendor docs, it can be inconsistent for enterprise apps depending on iOS version (iOS 6 and iOS7 values may be not the same for same enterprise app).
    Another inconsistency cause - ad-hoc apps installation.
    And another one: "The value changes when the user deletes all of that vendor’s apps from the device and subsequently reinstalls one or more of them". It's not clear for me if vendor id should change on usual app update or not.

    If deviceUniqueIdentifier can't read from identifierForVendor for some reason, it will try to read from advertisingIdentifier.
    As we can read from advertisingIdentifier docs, it is more suitable for usage for security and fraud detection needs even if app is not advertisingTrackingEnabled. But, we can use this API "only for serving advertisements", thus your app will be rejected from App Store if you use deviceUniqueIdentifier, but have no any AD stuff in app. Example:
    "We found your app uses the iOS Advertising Identifier but does not include ad functionality. This does not comply with the terms of the iOS Developer Program License Agreement, as required by the App Store Review Guidelines." (PLA 3.3.12).
    advertisingIdentifier may change in some rare cases as well (in case of device reset, for example).

    So, deviceUniqueIdentifier in iOS looks not so reliable and even dangerous to use at all. This is how it looks from my point of view, of course, I'd glad to know I'm wrong here.

    For now, I can't figure out which Unity APIs can give us consistent device ID or something, what could replace it on iOS.
    I'm looking to conjunction of:

    SystemInfo.deviceModel
    SystemInfo.graphicsDeviceID
    SystemInfo.graphicsDeviceVendorID
    SystemInfo.processorCount
    SystemInfo.processorType
    SystemInfo.supportsAccelerometer
    SystemInfo.supportsGyroscope
    SystemInfo.systemMemorySize

    APIs to get semi-unique device ID (should be more reliable than deviceUniqueIdentifier in terms of consistency, will be same for same devices though).
    I can't find any consistency info on all these APIs. I'd be really glad to hear from Unity Tech guys if these APIs are return consistent values for same device for all iOS starting from 6 version thus I can rely on them in terms device ID generation, at least for same devices.
     
    Last edited: Jun 5, 2014
  4. tomerpeledNG

    tomerpeledNG

    Joined:
    Jul 14, 2017
    Posts:
    81
    Hi,

    Pretty old thread, but I still don't understand something.
    Can we use the advertisingIdentifier directly in order to identify the device id of our users?
    When we use the deviceUniqueIdentifier , it sometimes reset itself on app updates - not even uninstall-install, just updates...
    So we want to start using the advertisingIdentifier directly, since we understand it not suppose to change easily, but as we understand according to Apple we shouldn't suppose to use it?