Android Question Trying to dial a telephone number

Colin Evans

Active Member
Licensed User
Longtime User
Hi, I've had a look at some of the forum content but I can't seem to get the program to dial a number from clicking an object

B4X:
Sub label3_click
    Dim p As PhoneCalls
    StartActivity(p.Call("0123456789"))
End Sub

Obviously in the above example its a dummy number

But when using the correct number I get the following error message in the log file

java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.CALL dat=tel:xxxxxxxxxxx flg=0x20000 cmp=com.android.server.telecom/.components.UserCallActivity } from ProcessRecord{f037c70 7254:ditl.sunnside/u0a334} (pid=7254, uid=10334) with revoked permission android.permission.CALL_PHONE

I have added the following in the Manifest file

AddPermission(android.permission.CALL_PHONE)
AddPermission(android.permission.CALL_PRIVILEGED)

Any idea's where I'm going wrong
 

f0raster0

Well-Known Member
Licensed User
Longtime User
it works for me:
B4X:
Sub Button1_Click

    Dim p As PhoneCalls
    StartActivity(p.Call("+123456789"))

End Sub
in the manifest I have that:
AddPermission(android.permission.READ_PHONE_STATE)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Last edited:
Upvote 0

Colin Evans

Active Member
Licensed User
Longtime User
Tried it with the new manifest addition and with it and removing the others but it still returns the same error and crashes the program, do you have an example you could upload to see where I'm going wrong, I just need one button to dial one number.

Not sure on the RuntimePermission as I can't see anything related to the phone in the example you mention
 
Upvote 0
Top