Is There a Unique Id That We Can Read From Androind Tablet
How to generate Android Unique ID
Generate unique ID at Android platform is a recurring theme amid developers and it's very important in order to perform:
- app installs/uninstalls
- user behavior in anonymous mode.
- ads campaigns
- point of attention
- client/server communication
- login validation
- in-app buy verification
- licensing purposes
In that location is no unique reply to that question ( y'all've got the pun) , but throughout the years many people has think most information technology and create inventive solutions to this subject.
Actually this kind of problem still happens in others platforms, mainly in web since there is no reliable mode to know for certain , who that anonymous user is and which devices he is using.
A simple Google search and you lot can find some StackOverflow threads which tin enlighten your pursuit, but instead of merely copy and paste the kickoff checked respond, as a good developer , yous should analyze all alternatives and this post can help yous out.
Google recommendation is described below in four basic points:
Avoid using hardware identifiers. In most apply cases, you can avoid using hardware identifiers, such equally SSAID (Android ID), without limiting required functionality. Android 10 (API level 29) adds restrictions for not-resettable identifiers, which include both IMEI and serial number. Your app must be a device or profile possessor app, have special carrier permissions, or have the READ_PRIVILEGED_PHONE_STATE privileged permission in lodge to admission these identifiers.
Only utilize an Advertisement ID for user profiling or ads use cases. When using an Advertising ID, e'er respect users' selections regarding ad tracking. Besides, ensure that the identifier cannot be connected to personally identifiable information (PII), and avoid bridging Advertising ID resets.
Employ an Instance ID or a privately stored GUID whenever possible for all other utilize cases, except for payment fraud prevention and telephony. For the vast majority of non-ads use cases, an Case ID or GUID should be sufficient.
Utilize APIs that are advisable for your use instance to minimize privacy take chances. Apply the DRM API for loftier-value content protection and the SafetyNet APIs for abuse protection. The SafetyNet APIs are the easiest way to determine whether a device is genuine without incurring privacy risk.
If for some reason, I don't have time or don't wanna follow Google'south advices , what are the alternatives?
Pseudo Unique ID
Pseudo Unique ID is basically a generated string, often encoded in base64 created by many data pieces together.
For case if you are developing an video streaming app ,you should exist tempted to use one strategy similar movieId + usedId + timestamp(seconds precision) to validate session as DRM, which is strictly discouraged, since Android has one proficient media DRM API in the platform.
Also if you are working in an app shop or market place kind of product, the most easy thinkable approach could be one pseudo ID which concat IMEI, Build.Serial , ANDROID_ID and MAC_ADDRESS , simply since Android half dozen , information technology's not a proficient idea and this is why.
MAC Address
Most of the references and posts spot this as a valid device identifier, however since Android 6 Marshmallow , Google has "nerfed" this , brand information technology returns an abiding value 02:00:00:00:00:00.
Updated April 2020
MAC accost randomization
On devices that run Android 10 or higher, the organisation transmits randomized MAC addresses by default.
More at docs
IMEI/IMSI/ESN/PhoneNumber
Yous tin admission phone info hands using snippet in gist above, just in order to fetch those info, you need put i more permission at AndroidManifest.xml
Since Android 6, these permission has been put nether runtime permissions category, which ways you don't grant it by default at installation and demand to add some lawmaking in society to enquire it for user approval, and depending on what your app does, information technology tin can be viewed equally suspicious.
Likewise, even if user grant it to you lot, information technology doesn't work reliably. When it does work, that value survives device wipes ("Mill resets") and thus y'all could stop up making a nasty mistake when i of your customers wipes their device and passes it on to another person.
Likewise it this can return wrong or useful values every bit goose egg ,"" ,"???????", constants or a stale phone number that is no longer valid.
Updated April 2020
Restriction on not-resettable device identifiers
Starting in Android 10, apps must have the
READ_PRIVILEGED_PHONE_STATEprivileged permission in lodge to access the device's non-resettable identifiers, which include both IMEI and series number.Caution: Third-party apps installed from the Google Play Store cannot declare privileged permissions.
More than at docs
Secure ID
Settings.Secure.ANDROID_ID is a 64 bit hex Cord generated when device is first setup, but it'south sensitive to factory resets. You tin use code below:
However there is some changes at Android 8 Oreo where the ANDROID_ID value is unique to each combination of app-signing key, user, and device, existence scoped by signing key and user.
Build.SERIAL
Build.Series field have been used widely since API ix Gingerbread and used to return hardware series needed by telco's.
However has been deprecated in Android 8 , and afterward Android nine , you need some privileged permissions at paradigm level or it returns Build#UNKNOWN , here is the caption.
You as well be able to use some data info from device provided by Build class , for example , in gild to accept such a device contour, which in worst example can be used to segment different audition. This technique is still used by Firebase, Crashlytics and many other analytics tracker and crash report SDK tools.
Decision
In the end, if you don't wanna follow Google's advices , the near easy and reliable way to get job done is:
Information technology can be saved in a durable way in the storage regarding your use case, which is out of the scope of the mail service.
- Best Practices for Unique Identifiers
- Changes to Device Identifiers in Android O
References
- https://developer.android.com/training/manufactures/user-information-ids
- https://android-developers.googleblog.com/2017/04/changes-to-device-identifiers-in.html
- https://android-developers.googleblog.com/2011/03/identifying-app-installations.html
- https://medium.com/@ssaurel/how-to-retrieve-an-unique-id-to-identify-android-devices-6f99fd5369eb
- https://stackoverflow.com/questions/2785485/is-there-a-unique-android-device-id
- https://developer.android.com/nigh/versions/oreo/android-8.0-changes#privacy-all
thompsondoomplast.blogspot.com
Source: https://proandroiddev.com/how-to-generate-android-unique-id-38362794e1a8
0 Response to "Is There a Unique Id That We Can Read From Androind Tablet"
Post a Comment