Finally, I got a solution using this code. I hope this will be useful for anyone who wants to handle dual SIM phones. His work is wonderful for me.
Please add the codes below to your BroadcastReceiver class:
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 == "0"){
source share