public static String[]getInvokeImei(Activity context) {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
Class clazz = telephonyManager.getClass();
Method getImei =null;
String[] imei=new String[2];
try {
getImei = clazz.getDeclaredMethod(StringCf.GI, int.class);
imei[0]=(String) getImei.invoke(telephonyManager, 0);
imei[1]=(String) getImei.invoke(telephonyManager, 1);
//Log.e(TAG, "IMEI1 : " + getImei.invoke(telephonyManager, 0) + "IMEI2:" + getImei.invoke(telephonyManager, 1)); //卡1
}catch (Exception e) {
e.printStackTrace();
}
return imei;
}
网友评论