I'm writing a custom Android contacts directory, I have implemented the ContactsContract.Directory provider and the search from within the phone app works fine.
The problem I am facing now is that when I have an incoming/outgoing call the Android dialer does not query the custom directory I registered. Is it possible to partake in caller ID resolution via PhoneLookup or some other way?
Also as a possible workaround I have tried implementing an outgoing/incoming call interceptor with BroadcastReceiver but I see no way of returning the contact data to the dialer. The only option I have found for displaying the data is to overlay a transparent activity over the native dialer. Is there a way to return contact data back to the dialer that sent the broadcast? Any other ideas I could try?
PS. Google uses the functionality I'm trying to implement for nearby places directory listings and Caller ID by Google.
PPS. By reading the ContactsContract implementation of PhoneLookup I stumbled upon corporate contacts directory that can be appended to the user profile's default directory, according to the code it should get queried for PhoneLookup, so I'm going to try that on Monday.
来源:https://stackoverflow.com/questions/32120252/android-directory-data-provider-for-phonelookup