본문 바로가기

JAVA/Android

안드로이드 고유ID(UUID) 가져오기.

Android UUID 가져오기.


private String GetDevicesUUID(Context mContext) {


final TelephonyManager tm = (TelephonyManager) mContext

.getSystemService(Context.TELEPHONY_SERVICE);


final String tmDevice, tmSerial, 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 deviceId = deviceUuid.toString();


return deviceId;

}