public static StringgetIMSI(Context context) {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
return "";
}
if (!PermissionUtil.getInstance().checkPermissions(context, android.Manifest.permission.READ_PHONE_STATE)) {
return "";
}
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
//获取IMSI号
@SuppressLint("MissingPermission") String imsi = telephonyManager.getSubscriberId();
if (null == imsi) {
imsi ="";
}
return imsi;
}catch (Exception e) {
e.printStackTrace();
return "";
}
}