Thursday, April 11, 2013

Accessing Inbox In Android

In Android we can Access all the SMS stored in Inbox.
we can also fetch the Sender Number, Data, Time SMS Body etc.

we use ContentResolver to query the Inbox table

 Access Inbox:

Cursor cursor = getContentResolver().query(Uri.parse("content://sms/inbox"), null, null, null, null);

    String senderNumber=cursor.getString(cursor.getColumnIndex("address"));
    String smsBody=cursor.getString(cursor.getColumnIndex("body"));
    String dateTime=cursor.getString(cursor.getColumnIndex("date"));

No comments:

Post a Comment