UUID + unique identifier of device serial number (unchangeable)
Private String getMyUUID (){
Final TelephonyManager tm = (TelephonyManager) getBaseContext (). getSystemService (Context. TELEPHONY_SERVICE );
Final String tmDevice, tmSerial, tmPhone, androidId;
TmDevice = "" + tm. getDeviceId ();
TmSerial = "" + tm. getSimSerialNumber ();
AndroidId = "" + android. provider. Settings. Secure. getString (getContentResolver (), android. provider. Settings. Secure. ANDROID_ID );
UUID deviceUuid = new UUID (androidId. hashCode (), (long) tmDevice. hashCode () <32) | tmSerial. hashCode ());
String uniqueId = deviceUuid. toString ();
Log. d ("debug", "uuid =" + uniqueId );
Return uniqueId;
}
Java
Private String getMyUUID (){
UUID uuid = UUID. randomUUID ();
String uniqueId = uuid. toString ();
Log. d ("debug", "-----> UUID" + uuid );
Return uniqueId;
}
The format is as follows:
D22f30b8-2716-41d2-84f2-4cd56bb75ecc