Android编程imei getDeviceID(电话管理器)
在Android编程中,如何获得API级别19(kitkat)的IMEI编号 我使用了Android编程imei getDeviceID(电话管理器),android,imei,Android,Imei,在Android编程中,如何获得API级别19(kitkat)的IMEI编号 我使用了getDeviceID(telephonyManager),但它只在API 22之前工作,而不低于API级别19 还有其他功能可以使用吗?您可以尝试以下方法: TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (ActivityCom
getDeviceID(telephonyManager)
,但它只在API 22之前工作,而不低于API级别19
还有其他功能可以使用吗?您可以尝试以下方法:
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (ActivityCompat.checkSelfPermission(context,
Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
return;
}
String IMEI_Number = telephonyManager.getDeviceId();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
String Imei0Id = telephonyManager.getDeviceId(0); // hear 0 is slot number
if (null != Imei0Id && !Imei0Id.equals("000000000000000")) {
IMEI_Number = Imei0Id;
}
}
同时检查此链接,了解好的概念
在左侧,您找到了我在下图中用红色标记提到的API级别选项。
它将显示哪些被使用或未被使用。