如何在双SIM卡Android手机中找到来电的目标SIM卡?

问题描述:

我正在创建一个Android应用程序,在该应用程序中,我需要检测双SIM卡电话中的传入呼叫的​​目标SIM卡. Android API仅提供一个SIM卡的访问权限.我确实对此进行了搜索,但找不到解决方案.我发现的全部是,我们无法检测到目标SIM卡,因为这取决于设备制造商.

I am creating an android application in which I need to detect the target sim for an incoming call in dual sim phone. The Android API provides the access of only one SIM. I did googling about this but couldn't find the solution, All I found is that we can not detect the target SIM because this is depend upon the device manufactures.

有没有可用于检测目标SIM卡的API?

Is there any API available to detect the target SIM ?

在棒棒糖22+中

public class MessageReceiver extends BroadcastReceiver {
@Override
 public void onReceive(Context context, Intent intent) {  
  int slot = Integer.parseInt((String) intent.getExtras().get("slot"));
  if(slot == 0){
    // sim1
  }
  if(slot == 1){
    // sim2
  }
}

}

在Lenovo K3 note中测试

tested in Lenovo K3 note