Open top menu






private void getDeviceId(){
try {
String deviceId = "";
if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.O_MR1) {
deviceId = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID);
} else {
deviceId = Build.SERIAL;
}
if (deviceId.equals("")) {
deviceId = UUID.randomUUID().toString();
}
ApplicationSetting.saveString("DeviceId", deviceId);
} catch (
Exception e) {
e.printStackTrace();
}
}
Read more