2

What is the behavior of TelephonyManager.getDeviceId() in Android L and older dual SIM devices? I know in API Level 23 (Android M) TelephonyManager.getDeviceId(int slotId) was added so that we can specify which SIM slot to retrieve the IMEI from, but what about in older devices? Will the IMEI from the first slot always be returned, or is it non-deterministic? I cannot find any official documentation on this.

Thanks!

user1118764
  • 9,255
  • 18
  • 61
  • 113

2 Answers2

0

Based on my experience you would get on older devices the sim configured as primary or default sim for calls in phone settings. So you will not always get the first sim slot IMEI. if there is no default sim for calls(always ask option) then the first sim slot IMEI is returned.

steveen zoleko
  • 395
  • 8
  • 23
0

To put it in a simple way, IMEI/Device Id is tagged to sim slot.

For dual SIM phones there are three IMEI values(one for each slot) and IMEI-SV.

Let’s say IMEI for slot 1 is: 123456789012345

IMEI for slot 2 is: 012500123456789

Depending on the scenarios, following is the returned value by telephonyManagerObj.getDeviceId():

  1. When you don’t have any SIM card, the method will return IMEI for slot1 i.e. 123456789012345
  2. When you have SIM card in slot 1, the method will return IMEI for slot1 i.e. 123456789012345
  3. When you have SIM card in both slots, the method will return IMEI for slot1 i.e. 123456789012345
  4. But when you have SIM card only in slot 2, the method will return IMEI for slot2 i.e. 012500123456789
  5. I found that on one device when I insert the SIM card incorrectly in slot 1 then the method returned IMEI-SV
Sagar
  • 23,903
  • 4
  • 62
  • 62