Sunday, July 28, 2019

android - Device ID Giving null Value

I am trying to get Unique ID[I.E unique id of a device] by using below code



TelephonyManager tManager;

tManager = (TelephonyManager).getSystemService(Context.TELEPHONY_SERVICE);

String deviceId = tManager.getDeviceId();


Where deviceId Gives me Unique ID for Android Device. I am not testing this on emulator because in emulator i am getting value 000000000000000




Any way i am testing it on real devices,and this works fine for mostly all devices , but in some device i am getting value null



I have tested this on



Samsung Galaxy S3

Samsung Galaxy Tab3

Samsung Galaxy Star


Google Nexus4

Google Nexus5

Google Nexus7


In all the devices listed above it gives me correct out put except one Device and that is Google Nexus7, in this i m getting value null




So, ultimately my goal is to get unique value for each particular device, In case if this code gives me null value than i can try some alternate way



i heard that Device MAC Address is a unique for all devices, But unfortunately it just works on wifi connection.



So is there any other way to get unique value of each particular device?



Thanks Any way

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...