2

I have an application in which I want to identify the device with Unique ID,

I have tried multiple solutions but doing after phone reset unique ID gets changed(like ANDROID_ID)

I have used below StackOverflow links which are not usable now.

Is there a unique Android device ID?,

How to get unique device numer in Android?,

Get Unique ID of Android Device?,

How to get unique device hardware id in Android?,

Get unique device ID in android

Android Q has restricted access for IMEI and serial number. It is available only for platforms and apps with special carrier permission. Also, permission READ_PRIVILEGED_PHONE_STATE is not available for non-platform apps.

Many people may mark this as duplicate but please note that I am looking for a unique id that will last for a device. (which will not change even after resetting/formating the device)

Amin Pinjari
  • 2,129
  • 3
  • 25
  • 53
  • 1
    Did you tried to get the WIFI mac address – Lakhwinder Singh Jul 15 '19 at 12:25
  • what you mean last for device ? Mostly when user uninstall application Everything removes belongs to that application. So which type of id you asking for ? – Ashish Jul 15 '19 at 12:25
  • @ Lakhwinder Singh On some devices, it's not available when Wi-Fi is turned off. From Android 6.x, it returns consistent fake mac address: 02:00:00:00:00:00 – Amin Pinjari Jul 15 '19 at 12:27
  • 1
    @LakhwinderSingh WiFi mac address isn't unique. What if two devices are connected to a WiFi? Then you'll have two devices with the same ID – Zun Jul 15 '19 at 12:38

1 Answers1

3

It's not possible in latest Android versions by design to prevent apps from tracking devices due to privacy reasons. Especially if you want to track after a device factory reset as mentioned.

See Best Practices Guide

Recommendation is to use Advertising ID and not associate it with any hardware identifiers. You may identify the user account, but not the device itself. This allows the user to change the user account if they deem necessary or uninstall/reinstall the app at worst.

Play Store policy notes

Association with personally-identifiable information or other identifiers. The advertising identifier must not be connected to personally-identifiable information or associated with any persistent device identifier (for example: SSID, MAC address, IMEI, etc.) without explicit consent of the user.

Now, you may track a device as long as

  1. you don't distribute your app via the play store (i.e sideloading, but you do risk getting booted if Play Protect on device may notice you. I can't remember the default setting, but if the device has play services, it may scan sideloaded apps and remove them if it finds malicious behavior.)
  2. Use hardware identifiers on older versions of Android, (still subject to Play Protect, and also Play Store if you distribute through there) or force users to use a custom ROM
Madushan
  • 6,977
  • 31
  • 79