How to Retrieve the Terminal's MEID Number: Difference between revisions
Jeff nouse (talk | contribs) m (Jeff moved page How to get MEID to How to obtain MEID of the terminal) |
Jeff nouse (talk | contribs) No edit summary |
||
| Line 1: | Line 1: | ||
The code snippet is as follows: | |||
private static String getMEID(Context context,TelephonyManager telephonyManager){ | private static String getMEID(Context context,TelephonyManager telephonyManager){ | ||
String meid = null; | String meid = null; | ||
Revision as of 04:55, 29 March 2020
The code snippet is as follows:
private static String getMEID(Context context,TelephonyManager telephonyManager){
String meid = null;
int count = telephonyManager.getPhoneCount();
for (int i = 0; i < count; i++) {
int[] subIds = SubscriptionManager.getSubId(i);
int phoneType = telephonyManager.getCurrentPhoneType(subIds[0]);
if(phoneType == TelephonyManager.PHONE_TYPE_CDMA){
meid = telephonyManager.getDeviceId(i);
android.util.Log.d("meid ", " meid slot"+ i +" = "+ meid);
break;
}
}
if(!TextUtils.isEmpty(meid)&&(meid.length() == 14 || meid.length() == 15)){
return meid;
}
meid = Settings.Global.getString(
context.getContentResolver(),"cdma_meid_with_no_card");
android.util.Log.d("meid ", meid);
if(!TextUtils.isEmpty(meid)&&(meid.length() == 14 || meid.length() == 15)){
return meid;
}
return "";
}