public static String getDeviceUUID(final Context context) {
final SharedPreferencesCache cache = Session.getAppCache();
final String id = cache.getString(PROPERTY_DEVICE_ID);
UUID uuid = null;
if (id != null) {
uuid = UUID.fromString(id);
} else {
final String androidId = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
try {
if (!"9774d56d682e549c".equals(androidId)) {
uuid = UUID.nameUUIDFromBytes(androidId.getBytes("utf8"));
} else {
final String deviceId = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
uuid = deviceId != null ? UUID.nameUUIDFromBytes(deviceId.getBytes("utf8")) : UUID.randomUUID();
}
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
Bundle bundle = new Bundle();
bundle.putString(PROPERTY_DEVICE_ID, uuid.toString());
cache.save(bundle);
}
return uuid.toString();
}
2016년 4월 26일 화요일
안드로이드 Unique ID 생성하기
피드 구독하기:
댓글 (Atom)
언제까지의 개인정보처리방침
1. 개인정보의 처리 목적 언제까지 은(는) 다음의 목적을 위하여 개인정보를 처리하고 있으며, 다음의 목적 이외의 용도로는 이용하지 않습니다. - 고객 가입의사 확인, 고객에 대한 서비스 제공에 따른 본인 식별.인증, 회원자격 유지.관리, 물품 또는...
-
GET 방식으로 URL 파라매터를 넘길 때 한글이 깨지는 현상이 발생 할 때 아래와 같이 처리하면 된다. var url = "./test.do?name="+encodeURI(encodeURIComponent("한글...
-
1. 지정한 디렉토리에 존재하는 모든 파일의 용량을 표시 # du /etc 2. 지정한 디렉토리에 존재하는 모든 파일을 포함 한 용량을 표시 # du -s /etc 3. 2번의 결과에 읽기 쉽게 용량 단위를 붙여서 표시 ( huma...
-
elasticsearch Kibana 에서 Discover에서 검색 한 조건 그대로 DevTools 에서 사용하기 위해서는 "query_string" 을 사용하면 된다. 아래는 예제이며, 검색 기간은 "range...
댓글 없음:
댓글 쓰기