When I try to get device_id of my Samsung Galaxy Tab GT-P1010, It returns null value. I 'm using device_id for identify unique device in my database.
I am using following code for this:
String device_id;
TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
device_id = telephonyManager.getDeviceId();
Here I'm getting string device_id null.. This code is working fine for my all other device, HTC, LG, Google NExxus ICS etc..
Please give me solution for it ASAP.
Thanks, Jay Patel
If your requirement is only to generate unique identification of device, you can use the below code:
UUID id=UUID.randomUUID();
//store this in shared pref
String device_id=id.toString();
//later fetch it from share pref
UUID Id=UUID.fromString(device_id);
This is the standard way of recognising the device according to RFC4122