Mohammad Lotfi
Mohammad Lotfi

Reputation: 400

Detect which SIM card has received message

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.

Upvotes: 6

Views: 2864

Answers (2)

icedman21
icedman21

Reputation: 1

This work for Lenovo phones with Mediatek chipsets

public void onReceive(Context context, Intent intent) {
    ...        
    int simId = intent.getIntExtra("simId", -1);
    ...
}

Upvotes: -1

Mike M.
Mike M.

Reputation: 39191

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.

Upvotes: 1

Related Questions