spr
spr

Reputation: 322

Android: How to get SIM-ID of both SIMs in Android?

I want to get unique id for SIM (line1number or simserialnumber...) when SMS is received. It works fine for single SIM. Is it possible for multi SIM?

Upvotes: 1

Views: 2155

Answers (2)

TryinHard
TryinHard

Reputation: 4118

Yes, You can use the SubscriptionManager to get the subscription information.

Also note that we have a Parcelable class for Subscription Information called SubscriptionInfo that has following method relevant to you:

public int getSimSlotIndex ()
public int getSubscriptionId ()

Upvotes: 0

HexAndBugs
HexAndBugs

Reputation: 5799

Multiple SIM support was only added to the standard Android API in Android 5.1 (Lollipop_MR1 - API Level 22) - see here. Devices earlier than that with multiple SIMs used customised versions of Android to support multiple SIMs, so there's no standard way to get the information you want as it will work differently on each device.

If you're targeting API Level 22 and above, you can use SubscriptionManager to get the information about different SIMs.

Upvotes: 4

Related Questions