类 PhoneUtils
- java.lang.Object
-
- cn.authing.guard.util.PhoneUtils
-
public class PhoneUtils extends java.lang.Object
-
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static java.lang.StringgetDeviceId(android.content.Context context)Return the unique device id.static java.lang.StringgetDeviceName()static java.lang.StringgetImei(android.content.Context context)static java.lang.StringgetIMEI(android.content.Context context)Return the IMEI.static java.lang.StringgetImeiOrMeid(boolean isImei, android.content.Context context)static java.lang.StringgetIMSI(android.content.Context context)Return the IMSI.static java.lang.StringgetManufacturer()static java.lang.StringgetMEID(android.content.Context context)Return the MEID.static java.lang.StringgetModel()static intgetPhoneType(android.content.Context context)Returns the current phone type.static java.lang.StringgetSDKVersionName()static java.lang.StringgetSerial()Return the serial of device.static java.lang.StringgetSimOperatorByMnc(android.content.Context context)Return the sim operator using mnc.static java.lang.StringgetSimOperatorName(android.content.Context context)Return the sim operator name.static java.lang.StringgetVerName(android.content.Context context)static booleanisPhone(android.content.Context context)Return whether the device is phone.static booleanisSimCardReady(android.content.Context context)Return whether sim card state is ready.
-
-
-
方法详细资料
-
isPhone
public static boolean isPhone(android.content.Context context)
Return whether the device is phone.- 返回:
true: yesfalse: no
-
getDeviceId
@RequiresPermission("android.permission.READ_PHONE_STATE") public static java.lang.String getDeviceId(android.content.Context context)Return the unique device id.If the version of SDK is greater than 28, it will return an empty string.
Must hold
<uses-permission android:name="android.permission.READ_PHONE_STATE" />- 返回:
- the unique device id
-
getSerial
@RequiresPermission("android.permission.READ_PHONE_STATE") public static java.lang.String getSerial()Return the serial of device.- 返回:
- the serial of device
-
getImei
public static java.lang.String getImei(android.content.Context context)
-
getIMEI
@RequiresPermission("android.permission.READ_PHONE_STATE") public static java.lang.String getIMEI(android.content.Context context)Return the IMEI.If the version of SDK is greater than 28, it will return an empty string.
Must hold
<uses-permission android:name="android.permission.READ_PHONE_STATE" />- 返回:
- the IMEI
-
getMEID
@RequiresPermission("android.permission.READ_PHONE_STATE") public static java.lang.String getMEID(android.content.Context context)Return the MEID.If the version of SDK is greater than 28, it will return an empty string.
Must hold
<uses-permission android:name="android.permission.READ_PHONE_STATE" />- 返回:
- the MEID
-
getImeiOrMeid
@RequiresPermission("android.permission.READ_PHONE_STATE") public static java.lang.String getImeiOrMeid(boolean isImei, android.content.Context context)
-
getIMSI
@RequiresPermission("android.permission.READ_PHONE_STATE") public static java.lang.String getIMSI(android.content.Context context)Return the IMSI.Must hold
<uses-permission android:name="android.permission.READ_PHONE_STATE" />- 返回:
- the IMSI
-
getPhoneType
public static int getPhoneType(android.content.Context context)
Returns the current phone type.- 返回:
- the current phone type
TelephonyManager.PHONE_TYPE_NONETelephonyManager.PHONE_TYPE_GSMTelephonyManager.PHONE_TYPE_CDMATelephonyManager.PHONE_TYPE_SIP
-
isSimCardReady
public static boolean isSimCardReady(android.content.Context context)
Return whether sim card state is ready.- 返回:
true: yesfalse: no
-
getSimOperatorName
public static java.lang.String getSimOperatorName(android.content.Context context)
Return the sim operator name.- 返回:
- the sim operator name
-
getSimOperatorByMnc
public static java.lang.String getSimOperatorByMnc(android.content.Context context)
Return the sim operator using mnc.- 返回:
- the sim operator
-
getModel
public static java.lang.String getModel()
-
getManufacturer
public static java.lang.String getManufacturer()
-
getDeviceName
public static java.lang.String getDeviceName()
-
getVerName
public static java.lang.String getVerName(android.content.Context context)
-
getSDKVersionName
public static java.lang.String getSDKVersionName()
-
-