问题描述
我正在尝试检测哪张 SIM 卡在支持双卡或三卡的手机上的 BroadcastReceiver 中收到了传入消息.
I'm trying to detect which SIM card has received the incoming message in BroadcastReceiver on a Dual or Triple SIM support phone.
注意:所有 SIM 卡都具有相同的 SMSC.
Note:All SIM cards has same SMSC.
推荐答案
似乎信息可能在 Intent extra 中,键为 "simSlot"
.
It seems that info might be in an Intent extra with the key "simSlot"
.
public void onReceive(Context context, Intent intent) {
...
int simSlot = intent.getIntExtra("simSlot", -1);
...
}
在我公认的简短搜索中,我也找不到任何相关信息,所以我不确定这有多普遍,或者可能在哪个 Android 版本中引入了它.我通过在我的设备上的接收器中转储交付的 Intent 上的所有额外内容找到了它.
I couldn't find any info on this, either, in my admittedly brief search, so I'm not sure how universal this is, or in which Android version this might have been introduced. I found it by dumping all the extras on the delivered Intent in a Receiver on my device.
这篇关于检测哪张 SIM 卡收到了消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!