October 2018
Intermediate to advanced
464 pages
15h 17m
English
First, to read existing messages, you'll need the following permission:
<uses-permission android:name="android.permission.READ_SMS" />
Here's an example of getting a cursor using the SMS content provider:
Cursor cursor = getContentResolver().query( Uri.parse("content://sms/"), null, null, null, null);while (cursor.moveToNext()) { textView.append("From :" + cursor.getString(1) + " : " + cursor.getString(11)+"\n");}
At the time of writing, the SMS content provider has over 30 columns. Here are the first 12, which are the most useful (remember, the column count starts at zero):