Android Question [SOLVED]Direct Dial not working

Zvi

Member
Licensed User
Hi, I'm a newbie to B4A.
I made an app in Kotlin that dials a number when a button is pressed.
I've tried doing this in B4A but permission is not given:
In Manifest File:
AddPermission(android.permission.CALL_PHONE)
(I've added the phone library).

In Main:
Sub call_Button_Click
myphone=myphone.Trim
Dim mynumber As String
Dim i As Intent
mynumber="tel:" & myphone
If rp.Check(rp.PERMISSION_CALL_PHONE)=False Then Return
i.Initialize(i.ACTION_CALL, mynumber)
StartActivity(i)
End Sub

On stepping through the code in debug mode rp.Check(rp.PERMISSION_CALL_PHONE) returns False

What am I doing wrong?
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Zvi

Member
Licensed User
Just solved it!
I had to add:
rp.CheckAndRequest(rp.PERMISSION_CALL_PHONE)
to Sub Activity_Create(FirstTime As Boolean)...
Now works perfectly.
 
Upvote 0
Top