简体   繁体   中英

Detect target phone number on incoming call

我有一部带2张SIM卡的Android手机,我想检测来电的目标 - 是SIM卡还是SIM卡2.是否可以从通话信息中获取目标号码?

Finally i got the solution its working fine for me. Hope it should helpful for everyone who wants to handle Duel SIM in mobile applications.

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"){
        // Incoming call from SIM1
    }
    else if(callingSIM =="1"){
        // Incoming call from SIM2
    }
 }
}

Your question dosent have answers in the documentations...

But I found out some links that may help you out:

  1. Checking for dual sim.
  2. Question regarding ui.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM