I have a problem integrating a VoIP application with Android smartwatch (any model). Our app uses Android ConnectionService API. The caller name is not displayed at the watch's incoming call notification - it simply writes "Unknown" or the caller id (4-digit extension), never the actual app contact name (app contact, not device contact). However, regular GSM calls are properly displayed (it resolves against the contact name) and also, if someone from my device contacts calls me, their name & avatar are being displayed correctly.
To assign the name I'm using android.telecom.Connection.setCallerDisplayName(displayName, TelecomManager.PRESENTATION_ALLOWED), but to no avail.
I had the same exact issue with Samsung Gear smartwatch. You see "Unknown" because the caller's name is resolved against device contacts (hence regular GSM calls work as expected). The solution is following:
displayName
(caller's name) andaddress
(caller's phone number). The address is the Uri which might look likesip:1234567
ortel:+1234567
, it doesn't really matter.displayName
andphoneNumber
. ThephoneNumber
here should beUri.schemeSpecificPart
of the address (the part after:
). The avatar/icon can also be added.ConnectionService
know that there is now a contact that corresponds to the Connection you created for your VoIP call.contactManager
is my class where aforementioned operations are executed,accountHandle
is aandroid.telecom.AccountHandle
that is used to registerPhoneAccount
(viatelecomManager.registerPhoneAccount()
),address
is our Uri with phone number.addNewIncomingCall
theConnectionService::onCreateIncomingConnection()
callback will be triggered, and in this function you should set the address:N.B.
ConnectionRequest.address
returnsnull
for me inonCreateIncomingConnection()
, that's why I pass it inextras
.setCallerDisplayName()
function and the common sense says that it should be there, but the fix was not related to it.