Android Question Show a name of the person we want to make a phone call

Alex_197

Well-Known Member
Licensed User
Longtime User
Hi, how to show a name of the person we want to make a phone call?

Let say person name is John Smith.

I tried this code

Make a phone call:
Private Sub MakePhoneCall()
    
    Try
        
        Dim i As Intent
        Dim Coordinator As String,CoordinatorPhone As String,CoordinatorExt As String
        
        
        Coordinator="John Smith"
        CoordinatorPhone="123-456-7890"
        CoordinatorExt="123"
        
        If CoordinatorExt <>"" Then
            CoordinatorPhone=CoordinatorPhone & "," & CoordinatorExt
        End If
        
        i.Initialize(i.ACTION_VIEW, "tel:" & Coordinator & " " & CoordinatorPhone)       
        StartActivity(i)

    Catch
        Log("MakePhoneCall " & LastException)
        modFun.ShowError("MakePhoneCall " & LastException)
    End Try
    
End Sub

It works fine, starts a dialer with a phone number but doesn't show a name.

Thanks
 

JohnC

Expert
Licensed User
Longtime User
Is the number that you are trying to dial already in the contact/phonebook of the device?

If not, then my guess is that it wont show a "name" (even though you are specifying a name in your sub) unless the number is already in the devices phonebook/contact database - just like it wont display the caller "name" of an incoming call if the number is not already in the devices contact list.

And even if the number is already in your device's contact list, I don't know if you can override the "name" that is displayed from your sub because it may still just display the name that is in the contact list.
 
Last edited:
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
Is the number that you are trying to dial already in the contact/phonebook of the device?

If not, then my guess is that it wont show a "name" unless the number is already in the devices phonebook/contact database - just like it wont display the caller "name" of an incoming call if the number is not in the devices contact list.

No, the number is not on a list.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Try adding the number (and name) into the contact list and then try your call code again. If the name appears, then a workaround could be that before you place the "call", you could first "temporarily" add the name/number to the devices contact list, then after the call, delete the contact.
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
Try adding the number (and name) into the contact list and try it again. If the name appears, then a workaround could be that before you place the "call", you could first "temporarily" add the name/number to the devices contact list, then after the call, delete the contact.
In my situation this is not a case, I can't ask a user to add a person to his contact list. I thought that I can provide a name on fly.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
What I am saying is that you can add the contact programmically to the user's contact list right before making the call, then delete it right after the call so the use wont notice it and they wont need to do anything.
 
Upvote 0
Top