1

As announced for Lollipop MR1, SubscriptionManager and its SubscriptionInfo provide lots of information about all (active) SIMs, but I'm missing their IMEIs.

I get info about SIMs like this:

    SubscriptionManager sm = SubscriptionManager.from(context);

    List<SubscriptionInfo> sil = sm.getActiveSubscriptionInfoList();
    if (sil != null) {
      for (SubscriptionInfo subInfo : sil) {
        Log.d(TAG, "SubInfo:" + subInfo);
      }
    } else {
      Log.d(TAG, "SubInfo: list is null");
    }

Am I missing something or can we still only get the IMEI (only of the 1st SIM card) via telephonyManager.getDeviceId()?

Saran
  • 3,845
  • 3
  • 37
  • 59

2 Answers2

2

The method

public String getDeviceId(int slotId)

is available under TelephonyManager in API 23. slotId is just a number from 0 to the number of SIMs - 1.

In API 22, the same method exists but is hidden. You need to use reflection to call it.

headuck
  • 2,763
  • 16
  • 19
0

The IMEI is used to identify the device, not the SIMs.So yes, you can only get the IMEI through telephonyManager.getDeviceId().

UPDATE: So it turns out I was wrong and a device can have an IMEI for each SIM card. I've found this answer in StackOverflow that can help you.

Android : Check whether the phone is dual SIM

Community
  • 1
  • 1
Tolio
  • 1,023
  • 13
  • 30
  • Possibly you never had a Dual SIM phone? At least check these for reference: http://2.bp.blogspot.com/-_ccAy-n4Tq0/U5zAjZvmk6I/AAAAAAAADss/6mpzfPfMuhw/s1600/Screenshot_2014-06-15-02-53-24.png, http://www.techsng.com/wp-content/uploads/2014/12/new-IMEI-Numbers1.png, http://i.stack.imgur.com/7Qiuh.jpg . – Saran Aug 06 '15 at 19:05
  • @Saran I'am surprised, it really can have more than one IMEI. I'll update my answer then. – Tolio Aug 07 '15 at 13:27