How to know which SIM card is making the outgoing call (Dual SIM)

advertisements

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?


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