I’m considering possibility to replace Android’s default SMS ContentProvider with my own one.
I’m talking about those which is called after:
context.getContentResolver().query(Uri.parse("content://sms/"),....);
I would dare to ask: is it possible?
No, That is internally used by the SMS messaging application AND the telephony layer of Android.
Replacing any in-built content providers is guaranteed to break Android – that is a given!
But what you can do is create your own content provider and craft your application to use your own instead.
If you’re talking about monitoring the sms content provider, what you can do is use a ContentObserver to watch on the sms content provider and forward the changes made to the sms content provider to your own.
Here’s an example of such scenario, everytime a change is made, the
onChangegets fired, it is within there, that relaying to your own custom content provider will suffice.Also, do not forget to unregister the content observer when the application is finished, i.e.: