ConnectionService TelecomManager Not Showing Up In Call History Correctly

Viewed 1044

I use addnewIncomingCall as shown below to display the incoming call ui screen

Bundle callInfo = new Bundle();
tm.addNewIncomingCall(handle, callInfo);

I also use

connection.setAddress(Uri.parse("David561"), TelecomManager.PRESENTATION_ALLOWED);

to change the caller id

enter image description here

The problem is that when I check call history on the actual phone (not app) I see 561 instead of David561 as shown below:

enter image description here

I even tried calling

connection.setCallerDisplayName("David561",TelecomManager.PRESENTATION_ALLOWED);

without any luck. It strips the letters and only keeps the number. I tried creating a contact for the phone number 561 and setting the name to David, and it actually shows up as David in the call history. But I don't want the user to have to create a contact. Is what I'm trying to achieve possible? If not, that's okay. I just want to confirm that it's not possible to get names to appear in the call history using TelecomManager and ConnectionService.

1 Answers

Not sure if it's changed a lot since this question was asked but through testing I have found that

connection.setAddress()

should contain the phone number/address of the user that the phone system will use to call back the caller and

connection.setCallerDisplayName

should contain the display name of the contact that will show up in the call history.

i.e. the code below will result in "Dave" being shown in the call history with his contact number being populated with "+1 123 1234 12345".

connection.setAddress("+1 123 1234 12345")
connection.setCallerDisplayName("Dave")

Note: both Address and CallerDisplayName need to be set in the contact otherwise the contact will come up as "UNKNOWN" in the call history information and when incoming calls are received.

Related