我只想确保在sim插槽中插入短信。对于一些sequrity原因,我采取SIM序列,这是SIM插槽一。所以对于验证我需要确保sim 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
}
}
}