There are many ways to get the mobile phone IMEI no. You can follow any of this process:
Process 1:
TelephonyManager mngr = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); mngr.getDeviceId();
add READ_PHONE_STATE permission to AndroidManifest.xml
Process 2:
Process 3:
Also you can get the both IMEI numbers using the below code
Process 4:
Hope it helps!! :)
Process 1:
TelephonyManager mngr = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); mngr.getDeviceId();
add READ_PHONE_STATE permission to AndroidManifest.xml
Process 2:
telephonyManager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
deviceId = telephonyManager.getDeviceId();
Log.d(TAG, "getDeviceId() " + deviceId);
phoneType = telephonyManager.getPhoneType();
Log.d(TAG, "getPhoneType () " + phoneType);
Process 3:
Also you can get the both IMEI numbers using the below code
TelephonyManager tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String imeiNumber1 = tm.getDeviceId(1); //(API level 23)
String imeiNumber2 = tm.getDeviceId(2);
Process 4:
telephonyManager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
deviceId = telephonyManager.getDeviceId();
Log.d(TAG, "getDeviceId() " + deviceId);
phoneType = telephonyManager.getPhoneType();
Log.d(TAG, "getPhoneType () " + phoneType);
Hope it helps!! :)
No comments:
Post a Comment