在android中检测sim 1或2中的调用或短信

时间:2015-05-11 11:13:11

标签: android

我只想确保在sim插槽中插入短信。对于一些sequrity原因,我采取SIM序列,这是SIM插槽一。所以对于验证我需要确保sim 1是短信的。

1 个答案:

答案 0 :(得分:2)

试试这个。它为我工作

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
             }
    }
}