마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

안드로이드 deviced id

0 추천

안드로이드 디바이스 id 값을 얻으려는데

숫자로만 이루어진 15자리 수가 나오는데 이게 맞나요 ?

영문+숫자로 이루어진 20자리정도라 들었는데 전 왜 숫자만 나오나요ㅜ ㅜ

TelephonyManager systemService = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String device_id = systemService.getDeviceId();

 

보꼬 (1,630 포인트) 님이 2015년 4월 2일 질문

1개의 답변

0 추천
 
채택된 답변

유니크한 디바이스 아이디 추출을 위해 개인적으로 다음과 같은 방법을 사용중입니다.

참고하세요.

public String getDeviceId(Context context) {
		TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

	    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());
	    return deviceUuid.toString();
	}

 

mamondebaltob (32,750 포인트) 님이 2015년 4월 2일 답변
보꼬님이 2015년 4월 7일 채택됨
아~ 좋은 정보 감사합니다 또 한개 배우네요^ ^
...