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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Unique Device Identifier

Discussion in 'Scripting' started by AllanMSmith, Jan 21, 2016.

  1. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    Hey,

    We're developing a freemium mobile game (focusing on iOS for the moment but Android soon), and to avoid the need of users creating accounts and so on (which is a form of barrier to start playing), we were using the "SystemInfo.deviceUniqueIdentifier" as the "key" for the user, however this value changes every time the user uninstalls and reinstalls the app.

    We've researched and saw people recommending using the advertisingIdentifier, which doesnt change on uninstalling/installing the app, however, the user can easily go to privacy settings and reset this value as well.

    Basically I would like to know if there is a unique, fixed, stable device identifier (at least for ios) we can rely on to stay the same forever. Or if anyone knows how games like Clash of Clans do it, because we're reaching a dead end =/ We tried even keeping this identifier in playerprefs, but then again, when the user deletes an app, its player prefs are deleted as well.

    Thanks for the attention,
    Best regards,
    Allan
     
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Use the Facebook login button as an option to save data on the cloud.

    If the user elects not to connect with Facebook, simply use the device identifier. There are fairly clear messages that deleting an app will also delete it's data.

    And in general there is no fixed identifier you can use. This is a deliberate choice by the platform holders to ensure user privacy.
     
  3. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    But how does Clash of Clans do it? Whats the wizardry behind it? It surely is possible in some way I have no idea of =P, the problem with posing the user with a login screen right in the beginning of the game is that mobile is already hard enough to hold a user for more than 10 seconds, with a login screen even if it uses facebook login, it gets even harder.
     
  4. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    Sorry for being pushy but... anyone has any other ideas? I've been toying with Clash of Clans and its amazing... if you turn off iCloud, reset advertising ID, turn off Game Center, Uninstall the App and all other apps from the vendor (supercell) then go ahead a re-install it, it still knows you are you... how is that possible?
     
  5. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    It probably doesn't completely remove everything and instead leaves behind a small data file somewhere. If you formatted the device and then reinstalled and it knew who you were then that'd be something else entirely.
     
  6. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    Kelso, that might be the case, yes, however from what I know apps only have permission to install data inside their own app folders... I went as far as Resetting all Settings on my device, and still, Clash of Clans still knows its the same device without asking a single question...
     
  7. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    I'd still lean towards it leaving something behind. Did you verify that uninstalling the app removes *everything*? If you literally wipe the entire device and reinstall the OS does it still know who you are? I'm not a mobile developer so there might be a less extreme way to test that.

    Other things to consider: If you install on two different devices using the same Apple Store account is the state of the app unique between the two? If you install on the same device using different accounts is it the same? (Possibly using account info as part of the determining factor). If you re-install and launch the app with no internet connection does it still work?
     
  8. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    Well, I managed to solve it using a GENIUS asset store plugin: https://www.assetstore.unity3d.com/en/#!/content/43083

    This is what I do believe clash of clans uses as well, since this is the only way to keep something in the device when your app is gone, and does not rely on ids that can be changed at any time.

    Anyway, thanks for the attention and I hope this helps the next hopeless guy looking for a solution like this, just spend 10 dollars and be done with it!
     
    geenura and Kiwasi like this.
  9. vfxjex

    vfxjex

    Joined:
    Jun 3, 2013
    Posts:
    93
  10. Citydom

    Citydom

    Joined:
    Mar 26, 2020
    Posts:
    1
    Hey.
    I am very interested in your discussion.
    Were you able to make progress and how?
    Thanks for the attention,
    Best regards,
    Al