SMS missing from content provider results on Andro

2020-02-01 09:06发布

问题:

Some text messages are missing and never show in the content://sms provider URI since the Samsung S7 came out. I have noticed this between multiple Samsung devices (S6 and/or S7) that are on the same carrier (in this case T-Mobile) but may not be limited to. These text messages are showing in the default stock messaging app, but I cannot find how to access them. Keep in mind that I receive 97% of text messages just fine through that content provider, but that last 3% eludes me.

Uri uri = Uri.parse("content://sms/");
String[] projection_sms = { "*" };
Cursor cursor = getContentResolver().query(uri, projection_sms, "", null, null);

I have also looked within the SIM card to see if the missing SMS may be there and found nothing:

Uri uri = Uri.parse("content://sms/icc");

I have gone through all MMS as well to find that they are not in there either.

<uses-permission android:name="android.permission.READ_SMS" />

I only want to read SMS in this case and according to the Android docs you would only need the above permission to read from the SMS/MMS db. I realize that in KitKat there was a change which allowed an app to replace the default stock app, but in this particular case I only want to read SMS.

So if those SMS are not in the correct places in the db and are not in the SIM card, then where on Earth (or should I say in Android) would they be?

回答1:

It seems the messages that are missing are in fact not SMS, but RCS messages. These are not stored in the SMS Provider, and therefore will not be returned from any queries to it, though messaging apps on devices that support RCS are likely to display them all together seamlessly. This would explain why it appears that your query results are incomplete.

RCS (Rich Communication Services) is basically enhanced SMS/MMS, offering functionalities such as real-time one-to-one and group chat, video calling, content sharing, etc., in addition to regular ol' text messaging. Currently, there is no standard API in Android for this, though Google is reportedly in the process of adopting this as an eventual replacement for SMS/MMS. I could find no official word on how this will be integrated or deployed, however.

Not every carrier offers RCS, and those that do have dedicated, proprietary apps and APIs to handle it. These, of course, are going to be different for each carrier/manufacturer, and even the branding varies widely. Most call it joyn, whereas T-Mobile brands it as Advanced Messaging. As RCS becomes more commonplace, it should become more standardized, but supporting RCS in your app currently will require specialized components and setups.