0

i have this code for read SMS

public List<String> getSMS(){
     List<String> sms = new ArrayList<String>();
        Uri uriSMSURI = Uri.parse("content://sms/inbox");
        Cursor cur = getContentResolver().query(uriSMSURI, null, null, null, null);

        while (cur.moveToNext()) {
               String address = cur.getString(cur.getColumnIndex("address"));
               String body = cur.getString(cur.getColumnIndexOrThrow("body"));
              sms.add("Number: " + address + " .Message: " + body);  

          }
        return sms;

    }

It reads only what is sent to me, How to read the entire conversation, Also what I sent

stackoverflow
  • 2,320
  • 3
  • 17
  • 21
Gold
  • 60,526
  • 100
  • 215
  • 315

1 Answers1

1

You can query sent messages using the content://sms/sent URI. Also, try content://sms/ to get all messages at once.

For more information refer to: https://stackoverflow.com/a/13709207/198996

Community
  • 1
  • 1
TomTasche
  • 5,448
  • 7
  • 41
  • 67
  • thank for the help, how to get the name of person that send the mail ? (if he in my phone-book) and how to sort by date and persone – Gold May 01 '13 at 10:03
  • @Gold You should post a new question for this to get answered. ;) – TomTasche May 01 '13 at 17:03