androidandroid-sms

How to fetch SMS of only one SIM in dual SIM phone?


I am working with SMS functionalities on Android. I have successfully fetched all the SMS from the phone and I want to filter those SMS by SIM 1 and SIM 2. I have checked the columns (the query to fetch SMS is returning) but can't figure out which column indicates SIM information

I am using this to get all SMS

Uri uriSMSURI = Uri.parse("content://sms/");
Cursor cur = activity.getContentResolver().query(uriSMSURI, null, "thread_id = "+thread, null, "_id DESC LIMIT "+limit +" offset "+(limit*page));

This returns all SMS but I want SMS from one SIM card only.

Any help or suggestion is welcome


Solution

  • well this are all the Columns for Threads I couldn't find anything related to sim though . But there is RECIPIENT_IDS:

    A string encoding of the recipient IDs of the recipients of the message, in numerical order and separated by spaces.

    Which you can check it by the sim number for received messages. also you have SMS wich contains PERSON ,ADRESS , CREATOR which you can also check them by sim number.