Android: Target SIM/Number of incoming call

Viewed 358

INB4: How to find target sim for an incoming call in dual sim android phone? <- does not work, sadly :(

So, I have a phone (A) with to SIM cards:

SIM 1 number: 123

SIM 2 number: 456

and I call from different phone (B: number 789) to 123. On phone A I'm able to detect incoming call and I'm able to get the incoming phone call number (789). What I can't do is detect that the call target was SIM 1 number: 123.

Can someone help me?

2 Answers

Try this:

public class MyCallReceiver extends BroadcastReceiver {
@Override
    public void onReceive(Context context, Intent intent) {
    String mySim = "";
    mySim = intent.getExtras().getInt("simId", -1);
    if(callingSIM == "0"){
        //SIM1
    }
    else if(callingSIM =="1"){
        //SIM2
    }
    }
}

Ok, I've finally manage to do this, but not directly. I'm getting all information I need from call history.

Related