Detect which SIM card has received message
Asked Answered
S

2

6

I'm trying to detect which SIM card has received the incoming message in BroadcastReceiver on a Dual or Triple SIM support phone.

Note: All SIM cards has same SMSC.

Spoon answered 27/2, 2015 at 9:55 Comment(2)
Tired searching references and Stackoverflow.Spoon
see this may be what you need https://mcmap.net/q/799579/-how-to-figure-out-which-sim-received-sms-in-dual-sim-android-deviceInbeing
E
1

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);
    ...
}

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.

Evy answered 27/2, 2015 at 10:42 Comment(2)
Didn't work for me in android 10. Always getting simSlot -1 on receiving SMS in both SIM cardsDara
@WijaySharma That doesn't surprise me. This should've been a comment, rather than an answer. Sorry that it mislead you. If I get some time later, I'll do some research, and update this answer. I'll let you know if/when I do.Evy
H
-1

This work for Lenovo phones with Mediatek chipsets

public void onReceive(Context context, Intent intent) {
    ...        
    int simId = intent.getIntExtra("simId", -1);
    ...
}
Helmsman answered 4/9, 2015 at 9:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.