Detecting target SimCard of incoming call in Multi-Sim devices

If you have done like this it should work. make sure your testing device runs on Android 5.1 or above. dual sim support is added in v 5.1 (Check here)

public class IncomingCallInterceptor extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
    String callingSIM = "";
    Bundle bundle = intent.getExtras();
    callingSIM = String.valueOf(bundle.getInt("simId", -1));

    if(callingSIM.equals("0")){
           // Incoming call from SIM1
        } else if(callingSIM.equals("1")){
           // Incoming call from SIM2
        }
    }
}

Make sure you added the below permission in manifest

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

NOTE :

These values need not to come all the time. network provider support is required .Please read the documentation here

Carrier id of the current subscription. Return UNKNOWN_CARRIER_ID if the subscription is unavailable or the carrier cannot be identified.