Get Permanent Unique ID for android device - android

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)

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
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.)
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

Related

Unique Android Device ID that can be acceptable by Play Store without Privacy Policy

I am new to Android Development so i do not have much knowledge about the Android Unique Ids and whether Play Store will accept my app or ask for me to include any PP. Purpose of using this is to identifier that which user is interested in the promotions that i will provide in my App (For this purpose I have my own view similar to Admob banner).
Please let me know that how i can achieve this.
I use Settings.Secure.ANDROID_ID
A 64-bit number (as a hex string) that is randomly generated when the user first sets up the device and should remain constant for the lifetime of the user's device. The value may change if a factory reset is performed on the device.
android.provider.Settings.Secure.getString(
context.getContentResolver(), Settings.Secure.ANDROID_ID);
It gets reset if user performs factory reset of device.

Does android device id changes on android version update?

i want to know does the android device id change when the android version is update to latest. If it changes, how can i get notified about the version change.
This may no longer be a correct answer. The following from https://android-developers.googleblog.com/2017/04/changes-to-device-identifiers-in.html
Android ID
In O, Android ID (Settings.Secure.ANDROID_ID or SSAID) has a different value for each app and each user on the device. Developers requiring a device-scoped identifier, should instead use a resettable identifier, such as Advertising ID, giving users more control. Advertising ID also provides a user-facing setting to limit ad tracking.
Additionally in Android O:
The ANDROID_ID value won't change on package uninstall/reinstall, as long as the package name and signing key are the same. Apps can rely on this value to maintain state across reinstalls.
If an app was installed on a device running an earlier version of Android, the Android ID remains the same when the device is updated to Android O, unless the app is uninstalled and reinstalled.
The Android ID value only changes if the device is factory reset or if the signing key rotates between uninstall and reinstall events.
This change is only required for device manufacturers shipping with Google Play services and Advertising ID. Other device manufacturers may provide an alternative resettable ID or continue to provide ANDROID ID.
Device ID is a 64-bit number (as a hexadecimal string) that is randomly generated on the device’s first boot and should remain constant for the lifetime of the device, though the value may change if a factory reset is performed on the device.
The device ID does not change when the Android version is updated to the latest version. If you want to change your device ID then visit here.
Yes it changes,
I found that device ID changed in my case. In my app each device is connected with my database for certain special tasks, varies device by device and I uniquely identify each device by Settings.Secure.ANDROID_ID which gives me device unique ID.
But I found that that it changed on one of Samsung android device and disconnected from Database Server.

Does ANDROID_ID depend on the internet access?

ANDROID_ID is often suggested as a unique identifier for Android devices. It's described as a "A 64-bit number (as a hex string) that is randomly generated when the user first sets up the device and should remain constant for the lifetime of the user's device. The value may change if a factory reset is performed on the device." (see: http://developer.android.com/reference/android/provider/Settings.Secure.html )
But I've seen some accounts on the web that the generation of the ANDROID_ID may be somehow related to or dependent on access to Google account information. For example here https://groups.google.com/forum/#!topic/android-developers/Rn15F7Ku4GM and here: https://groups.google.com/forum/#!msg/android-developers/y8nUytSKf7c/9kKLPjDrrEIJ.
The Android devices we ship with our products are unboxed and get their software installed in a secure environment without internet access - wifi yes, but no internet- and many of our customers are also high-security sites which also block outside access. Our Android devices are not associated with any sort of Google account. Does ANDROID_ID have any dependencies on internet access, Google accounts or Google Play?
The AOSP source code states in a comment:
A 64-bit number (as a hex string) that is randomly generated on the device's first boot and should remain constant for the lifetime of the device. (The value may change if a factory reset is performed on the device.)
This explicitly refers to first boot, not to first internet interaction etc. (The text you plucked from the docs is less clear, stating "when the user first sets up the device").

What's the purpose of Android Development device id?

What's the purpose of Android Development device id, under Developer Options on ICS? I've googled and found nothing.
The device id is yet another manner that your apps can be linked to your phone. Most apps are linked to your account, but some, particularly those that you could not pay for via market, used device id so that you could not buy an app and then install it on several devices.
It used to be hidden only, and maybe after the final is out, it will be hidden again.
for more information -
http://androidforums.com/motorola-droid-bionic/584694-ics-development-device-id.html
May be this will help you......
Every device has an android device ID, the only (user) way to reset this ID is to use android's reset to factory defaults options - so this ID should remain constant unless a phone is sold/transfers ownership etc. The ID should be unique across all devices across all time.
These properties make it a very useful thing to store licences/security against.

Univocally identifying Android users to offer a limited time license

I would like to publish an Android app with 2-years time support (this is due to API costs). After 2 years, the user has to buy the app again (if he wants).
There are at least 3 problems:
I want it to be easy and effortless for the user: so no "registration form" (if possible).
The app should work on other devices connected with the same Google account (as every payed app).
The app should not work if the user sells his device: so using device's IMEI isn't a very good solution.
I think that the definitive solution would be univocally identifying the user, but the question is: how to do that?
Do you think that AccountManager could be a solution?
Note that the app needs to connect to my server in order to work, so the solution can be implemented both client and/or server side.
You can try to uniquely identify the user using his/her phone number. This is what Wavesecure does.
This does have some implications:
a) your app cannot work on a wifi only tablet.
b) you will have to provide a way for users to migrate phone numbers in case they happen to change phones.
You said that:
The app should work on other devices connected with the same Google account (as every payed app).
Use the google account.
When the app starts have him choose a google account and save the account ID (the email address) server side.
Also make sure the user can change the referenced account, it should not make any difference, as long as you allow just one account per user.
Ideally, as time passes by, you may want to track the active installations for each user, and limit the number of devices (model name, IMEI if available, OS version etc) to prevent fake account sharing. But that's something you can do later.

Categories

Resources