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

Android - SystemInfo.deviceUniqueIdentifier

Discussion in 'Android' started by erre-rox, Sep 4, 2017.

  1. erre-rox

    erre-rox

    Joined:
    Dec 3, 2012
    Posts:
    23
    Hi all,

    I'm Andrea from 3GoGames. We are working on a third party project that was using SystemInfo.deviceUniqueIdentifier in order to provide a unique device id to login on server.

    The project was initially created using Unity 5.3.1p4. Now we are using Unity 5.6.3f1. Testing, we've found that SystemInfo.deviceUniqueIdentifier has changed on our Android device.

    Is there a way to get the older device unique identifier? We need it to allow users log in with their accounts.

    How is changed this feature? And where I can found the changelog related to this fix/change?

    Thank you.

    Best regards,
    Andrea.
     
  2. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Hello Andrea,

    In Unity 5.4 the SystemInfo.deviceUniqueIdentifier was changed to always return md5 of ANDROID_ID. In older versions we've had multiple fallbacks when determining this value. Please take a look at this post https://forum.unity3d.com/threads/unique-identifier-details.353256/ which specifies how SystemInfo.deviceUniqueIdentifier was determined before Unity 5.4.

    Best regards,
    Julius
     
    unityjingyao likes this.
  3. erre-rox

    erre-rox

    Joined:
    Dec 3, 2012
    Posts:
    23
    Hi,

    I read that thread in the meanwhile. So, If I understand correctly there are 3 different behaviours:

    - 1 Until Unity 4.5
    - 1 From Unity 4.6 to Unity 5.4
    - 1 After Unity 5.4

    Is it right? Because in that thread there is a piece of code that emulate old behaviours, but comments talk about versions <= 4.5 and >= 4.6.

    If I want to emulate Unity 5.3.1p4 behaviour I have to call that code with oldBehaviour = false. Correct?

    Thank you.

    Best regards,
    Andrea
     
  4. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Yes, you've understood everything correctly. There are 3 different behaviours and you should call that function with oldBehaviour = false.

    Best regards,
    Julius