Search code examples
javaandroidpermissionsimei

Looking for a unique device Id that doesn't need permissions to request it


Is there any unique Id for android device that doesn't need permissions to access it?

I'm looking for something cannot be changed in normal cases (not ROOTED devices) so I can use it to check users who installed the application and lock the user to run only on the selected device.

The Id i'm looking for should NOT be changed when the user make "restore to factory state" or formatting the system.

Thank you.


Solution

  • Based on what you've said here, it sounds like you only need a unique identifier that persists within an installation (as opposed to staying consistent after uninstall and re-install).

    If that's the case, then you could generate a UUID on first app launch (using UUID.randomUUID().toString()) and send it up to your server to store with that user account.

    Then store it locally on the device in an encrypted manner (e.g. using RealmDB with encryption or even encrypting and storing in shared prefs) to make fraud via retrieval/modification more difficult.