How to restrict ContentObserver to monitor incomin

2019-08-19 18:19发布

问题:

When we register a ContentObserver for monitoring changes in calls database

getApplicationContext().getContentResolver()
    .registerContentObserver(
            CallLog.Calls.CONTENT_URI, true, new CallsContentObserver(handler)); 

we use CallLog.Calls.CONTENT_URI. Is there a way to point ContentObserver to monitor only incoming calls from the predefined phone by means of the Uri? I mean to specify an Uri something like

CallLog.Calls.CONTENT_URI.buildUpon()
.appendQueryParameter(CallLog.Calls.TYPE, String.valueOf(CallLog.Calls.INCOMING_TYPE))
.appendQueryParameter(CallLog.Calls.NUMBER, "+15555215554")
.build()

instead of CallLog.Calls.CONTENT_URI.