How to find out which SIM is making the outgoing call (Dual SIM)

Dionisis K. picture Dionisis K. · Sep 6, 2013 · Viewed 11.6k times · Source

I would like to check which SIM is making an outgoing call for DUAL SIM android phones. Read this article Android : Check whether the phone is dual SIM.

Works like a charm, detects the sim state and if phone is dual SIM. Next step is to get SIM info during an outgoing call request so that i know which SIM is making the call and according to that take some action.

Can someone help me with that?

Answer

Fernando Rama picture Fernando Rama · Dec 11, 2013

I've tested and for Jelly Bean I was able to successfully identify the dialling SIM card. Tested also with triple SIM device and worked like a charm.

Code snippet for this inside your BroadcastReceiver:

int whichSIM = 0; // this for security fallback to SIM 1

if (intent.getExtras().containsKey("subscription")) {

    whichSIM = intent.getExtras().getInt("subscription");

}

// do whatever you need to with the information