How to get the SMS massage?

by lukewar » Tue, 13 Jan 2009 01:14:03 GMT

Sponsored Links
 I have a problem, how to get the sms massage in adroid. I have found a
solution how to get the incoming sms massage but still i can not get
to the already stored massages. Please help.


How to get the SMS massage?

by PRATAP SOLAPUR » Tue, 13 Jan 2009 13:14:07 GMT

 Look into android.telephony.gsm ann smsmanager classes...............


Sponsored Links

How to get the SMS massage?

by Genesio » Tue, 13 Jan 2009 19:00:58 GMT

 The simplest example is to open a Cursor in this way:

Cursor curSms = managedQuery(Uri.parse("content://sms"), null, null,
null, null);
(you can add /inbox in the Uri to get only incoming messages)

This Cursors has the following columns:

addressCol= mCurSms.getColumnIndex("address");
personCol= mCurSms.getColumnIndex("person");
Note: this is the Contact ID of the corresponding person, not the
actual Contact Name. You have to open a Cursor with People.CONTENT_URI
and get the value in "display_name" column.
dateCol = mCurSms.getColumnIndex("date");
protocolCol= mCurSms.getColumnIndex("protocol");
readCol = mCurSms.getColumnIndex("read");
statusCol = mCurSms.getColumnIndex("status");
typeCol = mCurSms.getColumnIndex("type");
subjectCol = mCurSms.getColumnIndex("subject");
bodyCol = mCurSms.getColumnIndex("body");

Some values are null, so make sure you check them.

Have fun.