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("한글...
-
기존의 log4j 로그를 logstash를 이용하여 elasticsearch에 Indexing 하는 작업을 진행 하던 중 Index를 일별로 나누어서 관리를 하기 위해서 log-YYYY-MM-dd 형식으로 쌓기로 결정을 하게 되었음. 우선 아래의 ...
-
./rmiregistry 1099 ./jstatd -p 1099 -J-Djava.security.policy=tools.policy -J-Djava.rmi.server.hostname=10.10.0.0
댓글 없음:
댓글 쓰기