Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

deviceUniqueIdentifier on Windows Phone and Windows Universal

Discussion in 'Windows' started by skyrusfxg, Mar 21, 2016.

  1. skyrusfxg

    skyrusfxg

    Joined:
    Jan 14, 2016
    Posts:
    127
    Hello. First versions of our game was under Windows Phone (Silverlight) platform. Since recent versions of Unity Windows Phone (Silverlight) platform was depricated, so we modified our game to run under Windows Store App type. Both versions of game used SystemInfo.deviceUniqueIdentifier. It turned out that they are generated on different platforms differently. We are experiencing huge problems with the update of our games to users. Is it possible to generate under Windows Store App platform SystemInfo.deviceUniqueIdentifier equal to Windows Phone (Silverlight) platform SystemInfo.deviceUniqueIdentifier ? What was the algorithm for creating SystemInfo.deviceUniqueIdentifier under Windows Phone (Silverlight) platform? Can we reproduce it under Windows Store App type?
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,624
    On Windows Phone 8.0 we get it like this:

    Code (CSharp):
    1. public string GetDeviceUniqueId()
    2.         {
    3.             object value;
    4.  
    5.             if (!DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out value))
    6.             {
    7.                 return string.Empty;
    8.             }
    9.  
    10.             var id = (byte[])value;
    11.             var sb = new StringBuilder(id.Length * 2);
    12.  
    13.             foreach (var @byte in id)
    14.             {
    15.                 sb.Append(hex[@byte >> 4]);
    16.                 sb.Append(hex[@byte & 15]);
    17.             }
    18.  
    19.             return sb.ToString();
    20.         }
    According documentation you should be able to do the same on WP8.1, but not on Windows Store Apps for desktop/tablet.
    On all 8.1 (phone and tablet) we return advertizing ID, if it's present, and fallback to HardwareIdentification.GetPackageSpecificToken() if advertizing id is not present.
     
  3. skyrusfxg

    skyrusfxg

    Joined:
    Jan 14, 2016
    Posts:
    127
    Thank you very much. It is really huge problem. I will generate it in Under Silverlight project type (Unity5.2) and WSA project type (Unity 5.3.3) using this algorithm then compare results.
     
  4. skyrusfxg

    skyrusfxg

    Joined:
    Jan 14, 2016
    Posts:
    127
    Aurimas, please tell how to obtain DeviceExtendedProperties ? Microsoft.Phone.Info namespace. Is there analog on WSA ?
    Windows.Devices.Enumeration.DeviceInformation .Id is the same ?
     
    Last edited: Mar 21, 2016
  5. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,624