@@ -36,33 +36,25 @@ public final class DeviceIdUtils {
|
||||
|
||||
if ( TextUtils.isEmpty( deviceId )) {
|
||||
deviceId = getDeviceIdInternal(appContext);
|
||||
if (!TextUtils.isEmpty(deviceId)) {
|
||||
saveDeviceId(appContext,deviceId);
|
||||
} else {
|
||||
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ) {
|
||||
if ( ContextCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE ) == PackageManager.PERMISSION_GRANTED ) {
|
||||
deviceId = (( TelephonyManager ) appContext.getSystemService( Context.TELEPHONY_SERVICE)).getSimSerialNumber();
|
||||
if (TextUtils.isEmpty(deviceId)) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (ContextCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) {
|
||||
deviceId = ((TelephonyManager) appContext.getSystemService(Context.TELEPHONY_SERVICE)).getSimSerialNumber();
|
||||
}
|
||||
}else{
|
||||
deviceId = (( TelephonyManager ) appContext.getSystemService( Context.TELEPHONY_SERVICE)).getSimSerialNumber();
|
||||
}
|
||||
if (!TextUtils.isEmpty(deviceId)) {
|
||||
saveDeviceId(appContext,deviceId);
|
||||
} else {
|
||||
deviceId = ((TelephonyManager) appContext.getSystemService(Context.TELEPHONY_SERVICE)).getSimSerialNumber();
|
||||
}
|
||||
if (TextUtils.isEmpty(deviceId)) {
|
||||
deviceId = getDeviceSerial();
|
||||
if (!TextUtils.isEmpty(deviceId) && !deviceId.equalsIgnoreCase("unknown")) {
|
||||
saveDeviceId(appContext,deviceId);
|
||||
} else {
|
||||
if (TextUtils.isEmpty(deviceId) || deviceId.equalsIgnoreCase("unknown")) {
|
||||
deviceId = getAndroidId(appContext);
|
||||
if (!TextUtils.isEmpty(deviceId)) {
|
||||
saveDeviceId(appContext,deviceId);
|
||||
} else {
|
||||
deviceId = String.valueOf( System.currentTimeMillis());
|
||||
saveDeviceId(appContext,deviceId);
|
||||
if (TextUtils.isEmpty(deviceId)) {
|
||||
deviceId = String.valueOf(System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
saveDeviceId(appContext,deviceId);
|
||||
}
|
||||
|
||||
return deviceId;
|
||||
|
||||
Reference in New Issue
Block a user