Custom ContactsDirectoryProvider is not called for some operations
Asked Answered
O

1

15

I've implemented custom ContactsDirectoryProvider which works fine when Contacts or Dialer applications are searching for contacts using URIs of the form content://com.android.contacts/data/phones/filter

However when InCallUI or CallLog are trying to retrieve contact info with URis content:/contacts/phone_lookup the query method of my provider is not called.

Any advice please....

P.S. I did not implement separate sync provider maybe this is the problem?

Odoriferous answered 2/5, 2017 at 15:10 Comment(3)
I've encountered this as well. The phone_lookup URI works fine on Nexus 5x (emulator), Pixel 2XL, LG 6. However, when I try it on a Samsung S6 or Note 8, the phone_lookup never gets invoked. It works for filtering, but the query never gets called for phone_lookup (an incoming call or call history) as they do on the other devices.Castillo
Having the same problem. Did you find solution @Castillo ?Dystrophy
Nope @wast... i gave up and went with the toast callerId approach for samsung devicesCastillo
M
0

A workaround that we are using is to use a BroadcastReceiver to listen to incoming calls:

<receiver android:name=".domain.callerid.CallerIdBroadcastReceiver">
    <intent-filter>
        <action android:name="android.intent.action.PHONE_STATE" />
    </intent-filter>
</receiver>

Then in the onReceive method of the BroadcastReceiver you can get the incoming number:

intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER)

(This requires the READ_CALL_LOG permission starting with Android Pie)

Then you can use the incoming number to match a person and show a toast and or notification

Minnie answered 28/2, 2019 at 20:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.