3

I'm writing an app which needs to read the user's text messages for it's basic operation. Google says, SMS content provider is not supported and may not be present in certain phones, or may not work in future versions of Android. I would like to know if anyone knows of any specific phones without the SMS content provider? I know the question has already been asked -

Is there any phone that doesn't have sms inbox content provider? but no one has provided an answer. Alternatively, if someone could suggest a way of reading incoming and outgoing messages using a standard API, that would be even better.

Community
  • 1
  • 1
BlueSilver
  • 1,052
  • 2
  • 10
  • 25

2 Answers2

3

I haven't been able to find a phone without an SMS content provider (at least from Google searches). I don't think manufacturers would take the risk of breaking compatibility with the numerous SMS applications out there (which all use this private API). Also, at this point there seems to be no standard way to access both incoming and outgoing messages.

Update: This has been made a public API with 4.4 - https://developer.android.com/reference/android/provider/Telephony.html

BlueSilver
  • 1,052
  • 2
  • 10
  • 25
2
Uri mSmsinboxQueryUri = Uri.parse("content://sms");
Cursor cursor1 = getContentResolver().query(
        mSmsinboxQueryUri,
        new String[] { "_id", "thread_id", "address", "person", "date",
                "body", "type" }, null, null, null);
startManagingCursor(cursor1);
String[] columns = new String[] { "address", "person", "date", "body",
        "type" };
if (cursor1.getCount() > 0) {
    String count = Integer.toString(cursor1.getCount());
    Log.e("Count",count);
    while (cursor1.moveToNext()) {
        out.write("<message>");
        String address = cursor1.getString(cursor1
                .getColumnIndex(columns[0]));
        String name = cursor1.getString(cursor1
                .getColumnIndex(columns[1]));
        String date = cursor1.getString(cursor1
                .getColumnIndex(columns[2]));
        String msg = cursor1.getString(cursor1
                .getColumnIndex(columns[3]));
        String type = cursor1.getString(cursor1
                .getColumnIndex(columns[4]));
}
}

and

Uri mSmsinboxQueryUri = Uri.parse("content://sms/inbox");
Uri mSmsinboxQueryUri = Uri.parse("content://sms/sent");

Use this uri u can read inbox as well as the sent items.

And the user permission in the manifest file is

<uses-permission android:name="android.permission.READ_SMS" />
kannappan
  • 2,250
  • 3
  • 25
  • 35
  • 1
    Perhaps you misunderstood my question. I wanted to know if anyone has come across a phone without the SMS content provider, or if there is a standard, 'official' way to access the Inbox. Your solution uses a hidden API. – BlueSilver Jun 14 '11 at 18:21