Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically retrieve IMEI number for dual SIM in android

For single SIM following code works:

TelephonyManager tm = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
String imei= tm.getDeviceId();

For dual SIM I tried code on following link:

Android : Check whether the phone is dual SIM

But it didnt work for me.

Let me know if any other solutions possible.

like image 210
NehaC Avatar asked Mar 20 '14 05:03

NehaC


People also ask

How do I find my IMEI number on my dual-SIM phone?

The easiest way to find it on an Android phone is to dial *#06#, after which the number should appear on your screen. If you have a dual-SIM phone, you'll see two numbers — one for each SIM slot. You can also check IMEI in your device's settings by heading to Settings> About phone > IMEI.

How can I check both IMEI numbers?

The simplest method of finding your phone's IMEI number is using the USSD code. This method is more or less the universal method. It works on almost all feature phones and smartphones. Dial *#06# on your phone.

Do dual-SIM phones have 2 IMEI numbers?

Important: Only one IMEI will appear if one SIM is being used in the device even if the phone is dual SIM. If you have a dual SIM device and are using two SIM cards, there will be two IMEI numbers shown as IMEI 1 and IMEI 2. Please consider IMEI 1 as your device's identification number.

How do I find my dual-SIM number?

How to Check If an Android Phone is Dual-SIM. To see if the phone your using is dual-SIM, go into your phone's Settings app. Tap on Network and internet. The SIM cards option should be right below Airplane mode.


2 Answers

Try using getDeviceId(int slotId) added in API level 23.

Returns the unique device ID of a subscription, for example, the IMEI for GSM and the MEID for CDMA phones. Return null if device ID is not available.

Requires Permission: READ_PHONE_STATE

like image 108
Dheeraj Vepakomma Avatar answered Sep 22 '22 13:09

Dheeraj Vepakomma


We can check whether phone single or dual sim by using Android API and IMEI for each sim Card

TelephonyManager manager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
Log.i("OmSai ", "Single or Dula Sim "+manager.getPhoneCount());
Log.i("OmSai ", "Defualt device ID "+manager.getDeviceId());
Log.i("OmSai ", "Single 1 "+manager.getDeviceId(0));
Log.i("OmSai ", "Single 2 "+manager.getDeviceId(1));
like image 35
Vijay Shelke Avatar answered Sep 22 '22 13:09

Vijay Shelke