Reading sms received after a date

what is sms
sms texts
sms unreliable
who invented sms
sms define
types of sms
sms format
application of sms

I'm trying to read all the sms I received after a date.

Here is the code:

Uri SMS_CONTENT_URI = Uri.parse("content://sms");  
Uri SMS_INBOX_CONTENT_URI = Uri.withAppendedPath(SMS_CONTENT_URI, "inbox");

Cursor cursor = context.getContentResolver().query( SMS_INBOX_CONTENT_URI, new String[] { "_id" }, "date>=61291393200000", null, null);  
//61291393200000 = 03/01/12

This returns me a empty cursor.

When I was executing this code:

Cursor cursor = context.getContentResolver().query( SMS_INBOX_CONTENT_URI, new String[] { "_id" }, "read=1", null, null);

Was returning me all the sms.

Somebody knows how to filter the sms by date?

I tried to execute in the send sms too, but had the same problem.

I use following code to retrieve sms messages after a particular date.

// First select the date shown by the datepicker.
// Here I am assuming that a DatePicker object is already created with id dpResult
// to select a particular date.
DatePicker datePicker = (DatePicker) findViewById(R.id.dpResult);


// Now create a SimpleDateFormat object.        
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");

// Add 1 in month as its 0 based indexing in datePicker but not in SimpleDateFormat
String selectedDate = datePicker.getYear() + "-" +  (datePicker.getMonth() + 1) + "-" +    datePicker.getDayOfMonth();

// Now create a start time for this date in order to setup the filter.
Date dateStart = formatter.parse(selectedDate + "T00:00:00");

// Now create the filter and query the messages.
String filter = "date>=" + dateStart.getTime();
final Uri SMS_INBOX = Uri.parse("content://sms/inbox");
Cursor cursor = getContentResolver().query(SMS_INBOX, null, filter, null, null);

while(cursor.moveToNext()) {

    // Perform the required stuff here.             
}
cursor.close();

Got above code snippet from http://realembed.blogspot.com/2013/11/retrieve-sms-message-on-particular-date.html

android - Reading sms received after a date, I use following code to retrieve sms messages after a particular date. // First select the date shown by the datepicker. // Here I am assuming that  I am wondering how to read last five SMS received from a particular mobile number on a particular date. I know how to read all SMS from a particular sender, and how to read the last SMS, but I am unable to fetch and read the last few SMS. I tried to read them by using "date DESC LIMIT 5" My code is like below

Did you try "date>='61291393200000'"?

It seems like numeric value SQL statement needs a quote 'xxx'.

How to read sms from a particular date in Android, You can create a method readSMS() as shown below where you can pass date and time to read the sms from that particular date. private void readSMS(String date, String time) { // Now create a SimpleDateFormat object. SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy'T'hh:mm:ss"); The Gentleman’s Guide to Texting After a Date We have bad news for dudes who overuse You only have to go on a couple of Tinder dates before you discover that people have wildly different ideas about how to appropriately communicate.

// Just pass time stamp as a third parameter in your cursor query . and you will get filtered date in ascending order. refer below.

     Cursor cursor = getContentResolver().query(Uri.parse("content://sms/inbox"),
 new String[] { "address", "date", "body", },"date>=1535547019783",null,"date ASC");

            if (cursor.moveToFirst()) { // must check the result to prevent exception
                do {
                    String msgData = "";
                    for(int ati=0;ati<cursor.getColumnCount();ati++)

                    {
                        msgData = "" + cursor.getColumnName(ati) + ":" + cursor.getString(ati);
                       String date= cursor.getString(cursor.getColumnIndex("body"));
                        Log.e("DATA",date);
                    }

                    // use msgData
                } while (cursor.moveToNext());
            } else {
                // empty box, no SMS
            }
    cursor.close();
        }

Retrieve sms messages on a particular date , In order to get sms messages received on a particular date in an READ_SMS" /​> in AndoirdManifest.xml to include sms reading permission in the app. Similarly in order to retrieve sms messages sent after a particular date  You should allow her a time frame of 12 hours to get back to you after the first date before declaring all hope lost. After that 12 hours has gone by, you can then send a second text to make sure that she doesn’t want to talk to you.

Text messaging, Messages could be sent and received on ISDN phones, and these can send SMS to any GSM phone. The possibility of doing something is one thing,  When I receive a sms text message, the time and date doesn't show. And if I want to view which time the message was sent, I have to click nine times! I think the possibility to view the time and date for the sms is really important and should be a basic thing there from the beginning.

Viewing your SMS inbox messages, Any inbound SMS message you receive is stored in an SMS inbox. You can set up inboxes for each keyword, sub-keyword or dedicated inbound number on your​  +CMGL is used to read SMS messages that have a certain status (examples: "received unread", "received read", "stored unsent" and "stored sent") from the message storage area. It also allows you to retrieve all SMS messages stored in the message storage area. Number of SMS messages returned.

Read the Text Messages Between U.S. and Ukrainian Officials, But it will be logic to do after we receive a confirmation of date. We inform about date of visit and about our expectations and our guarantees for  Time and date at which the SMS message arrived at the SMSC (available to incoming SMS messages only). The first octet (1 octet = 8 bits) of the TPDU (Transport Protocol Data Unit) of the SMS message.

Comments
  • I'm not working with that project anymore, but the code seems ok for me. I accepted the answer because of that.