Friday 27 December 2019

android - Strange issue of getting IMEI Number of Device



i am using following code in android to get IMEI number of phone



TelephonyManager telephonyManager = (TelephonyManager)getSystemService(this.TELEPHONY_SERVICE);
String imei = telephonyManager.getDeviceId().toString();


i have tested it on many phones




1) Samsung Ace (froyo)
2) Galaxy S
3) Galaxy S2
4) Samsung Geo (ginger bread)



works perfect and gives IMEI number



but while running same code on following deivce i get nothing :(




Android Pantech



any one guide me what could be the issue or if i use Device_ID to uniquely identify android device would that work for all devices?



and one more thing i have read in forum it is some times null and few famous devices give same Device_ID



any one put some light on it that what is the best way to uniquely identify device and that piece of code should work on all devices?



any help would be appreciated.


Answer





any one put some light on it that what is the best way to uniquely identify device and that piece of code should work on all devices?




Unfortunatelly there is no 100% perfect way to identify an Android device. This is because Google does not provide a reliable way for this. Instead it recommends to track application installations (versus tracking devices). Here is a nice talk on this: Identifying App Installations.


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...