Created
September 9, 2013 04:11
-
-
Save eunjae-lee/6491384 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String generateDeviceUniqueId() { | |
Context context = WithApplication.getInstance().getApplicationContext(); | |
final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); | |
final String tmDevice, tmSerial, androidId; | |
tmDevice = "" + tm.getDeviceId(); | |
tmSerial = "" + tm.getSimSerialNumber(); | |
androidId = "" + android.provider.Settings.Secure.getString(context.getContentResolver(), | |
android.provider.Settings.Secure.ANDROID_ID); | |
UUID deviceUuid = new UUID(androidId.hashCode(), ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode()); | |
String deviceId = deviceUuid.toString(); | |
return deviceId; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment