We've developed an app that needs to identify every device uniquely. We first thought of using IMEI and we're obtaining it using the TelefonyManager's getDeviceId() method.
But one user reported that the app doesn't work and it seems we weren't able to get the IMEI. I read here that some Nexus 7 don't have an IMEI, that they use another way for serial number: CSSN. How can I obtain it? Or, even better, is there a preferable way to uniquely identify every android device?
PS: We do have one Nexus 7 here for testing and it works perfectly, that's why before I said some Nexus 7.
It's recommended to identify every installation instead of every device. There are indeed several ways of identifying device, for example, Mac address, IMEI, Serial Number, ANDROID_ID , however, due to different OS Versions, devices an vender implementations, none of these are truly reliable. Check this out.
Try the below code to get the device serial number :
Log.i("TAG","android.os.Build.SERIAL: " + Build.SERIAL);
You may go through the Android Documentation.
Related
I have this internal android app for the phones.
The company has it's own custom management for all the devices.
Hole thing is working based on the imei , as a unique key to identify each phone.
As you know from Android 10, the imei identifier is not accessible anymore.
I have read a bunch of post and articles, but none seems to satisfy my needs, as I need an unique identifier, that lasts also after factory reset, reboot, uninstall and so on.
Please any suggestions, are welcomed.
Check first Answer here.
it's using UUID with MediaDrm.
Tested on Xiaomi Pocophone F1 with Android 10
and it survived reboot, uninstall.
I didn't test it yet over the factory reset.
In Android devices how is the unique Serial number is assigned to each device? Most of the Samsung devices have a unique serial number on each device. When is this serial number is inserted? Is this serial number assigned before firmware installation or after installing the firmware? Or it has some mechanisim/ algorithm to assign the serial number during firmware is installed.
I want to burn firmware to devices but need some algorithm which helps me to assign the unique serial number to each device and it will remain same even if the firmware is burned multiple times.
There are several options to identify a unique serial number in a android device. One of them being IMEI and another most commonly used is MAC. But from Android M version google has restrictions on people using MAC for unique identity and moreover you will need to have WIFI to be ON to read the MAC.
And also it is not advisable to use MAC/IMEI for secure reasons.
One other possible solution is to generate a unique global identifier in your code.
String uniqueID = UUID.randomUUID().toString.
At the highest level, a globally unique identifier will never have a collision - even on other devices/apps.
Source : https://developer.android.com/training/articles/user-data-ids.html#working_with_instance_ids_&_guids.
You can also try using android serial number which is unique number generated on first ever boot. But, please note that the serial number changes on Factory data reset.
For detailed insight into unique identifier please also look into android device id confusion
Hope I have answered your query.
The unique number is called IMEI. It is a unique number inserted in phone by the manufacturers. Every phone on earth has a different IMEI. Though with rooting your phone you can spoof it.
Hope this helps.
I have three questions on what and how the IMEI can be used. My current knowledge is the IMEI is the devices "Social Security Number", Source Here, so:
Can another phone/device have the same IMEI?
If not, can I have my app use the IMEI to recognize that the device it is on is the exact same device it was used on before?
If this one is also a yes how could I get the Android SDK to pull the IMEI for device validation. (I'm looking for something like ANDROID_PULL_IMEI then Android_VALIDATECHECK_KEY or similar)
CDMA devices have a MEID instead of an IMEI. This answer describes how to obtain them programmatically.
This is not foolproof. I've encountered cheap Chinese devices where TelephonyManager#getDeviceId() returns null or some obviously bogus string like "0123456789ABCDEF".
I'm thinking to have a third party to promo my app, and I'll pay them per install. In order to avoid fraud, I need to have a unique ID stored in my database. My problem here is that I can't find a reliable unique ID.
IMEI - only works on phone
Android ID - can be changed even not a rooted device
WLAN MAC - not all devices have wifi, or the device has wifi turned off.
Bluetooth MAC - same as above
I know device with root access can easily change the IDs, but let's not worry about it now. I assume no one has a rooted device. How do I get a unique ID???
Please help. Thanks
Try looking into OpenUDID for Android, there doesn't seem to be a better way to do what you want for the time being:
https://github.com/vieux/OpenUDID
Are there known bugs or issues with getConnectionInfo().getMacAddress() when it's used as a unique device identifier?
One of the alternatives, the Android ID, seems to be not available (or not really unique) on some tablets. FAIL...
The only problem that I know of is that it is only available if Wi-Fi is enabled.
I think this is a big problem because some smartphone users probably never turn Wi-Fi on. Your app can turn Wi-Fi on itself, but this means your app needs an additional permission "android.permission.CHANGE_WIFI_STATE".
Your general issue - how to uniquely identify the device - is widely discussed, e.g.
Is there a unique Android device ID?
http://android-developers.blogspot.ca/2011/03/identifying-app-installations.html
In this video from last year Google I/O, Reto Meier talked about exactly that problem off identifieng a device correctly.
For the solution you will have to watch the video, because I don't remember it anymore. But I do remember his concerns about the "MacAddress"-Solution. The problem about this solution his that it addresses a particular device and not a particular "installation", think of the problem when a user, who installed your app, sells his phone to another person which will also install your app. With the MacAddress you have no chance to distinct between those two ...