更新 DeviceInfoUtils.java
parent
6ae23c1e2f
commit
c0548705a2
|
|
@ -20,22 +20,6 @@ public class DeviceInfoUtils {
|
||||||
public static int getDeviceHeight(Context context) {
|
public static int getDeviceHeight(Context context) {
|
||||||
return context.getResources().getDisplayMetrics().heightPixels;
|
return context.getResources().getDisplayMetrics().heightPixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取设备的唯一标识, 需要 “android.permission.READ_Phone_STATE”权限
|
|
||||||
* Android 10 无法获取此权限
|
|
||||||
*/
|
|
||||||
public static String getIMEI(Context context) {
|
|
||||||
TelephonyManager tm = (TelephonyManager) context
|
|
||||||
.getSystemService(Context.TELEPHONY_SERVICE);
|
|
||||||
String deviceId = tm.getDeviceId();
|
|
||||||
if (deviceId == null) {
|
|
||||||
return "UnKnown";
|
|
||||||
} else {
|
|
||||||
return deviceId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取厂商名
|
* 获取厂商名
|
||||||
**/
|
**/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue