Automatic telephone call

anallie0

Active Member
Licensed User
Longtime User
hi
I have a button in my app, when I press it to do a phone number and call.
I used this code,

B4X:
Sub tel4_Click
   Dim result As Int
      result = Msgbox2("1530", "Vuoi chiamare la guardia costiera ?", "Si", "", "No", Null)
   If result = DialogResponse.Positive Then 
   Dim i As Intent
   i.Initialize(i.ACTION_VIEW, "tel:036275735")
   StartActivity(i)
   End If
End Sub

Open the dialer, but not start the call.
How do I start the phone call ?

Thanks
 

anallie0

Active Member
Licensed User
Longtime User
thanks Erel
now everything works except for one number (112) that in Italy is an emergency number and that you call do without credit.
By dialing this number you open the Diale but not start of the call.
Is there any way to overcome this?
 
Upvote 0

anallie0

Active Member
Licensed User
Longtime User
does not work :(

If I replace
AddPermission(android.permission.CALL_PHONE)
with
AddPermission(android.permission.CALL_PRIVILEGED)
tells me that missing android.permission.CALL_PHONE
if I add AddPermission(android.permission.CALL_PRIVILEGED)
does not change anything.
 
Upvote 0

egm

New Member
Licensed User
Longtime User
End a phone call

I´d like to make some call (no problem), but now after for example 30 seconds I need to shut down this call. Is there any way to make it without using airplane mode ?

Thanks
 
Upvote 0

HARRY

Active Member
Licensed User
Longtime User
I have a similar, almost equal, problem as at the start of this thread.

My code is as follows

B4X:
Sub BtnTel_Click
    Dim Ph As Intent
    Ph.Initialize(Ph.ACTION_CALL, TBTel.Text)
    StartActivity(Ph)

End Sub

TBTel.Text contains a valid telephone number like + 31553556554.



The program stops at the line StartActivity(Ph) with the message:
Last exception android content ActivityNotFoundException: No activity found to handle intent

I have added AddPermission(android.permission.CALL_PRIVILIGED) with the manifest editor. CALL_PHONE doesn't work either.

What am I doing wrong?

Harry
 
Upvote 0

lemonisdead

Well-Known Member
Licensed User
Longtime User
how do I know when it was serviced?
Hello,
You have to use the PhoneEvents and check the PhoneStateChanged event. When it changed from IDLE to OFFHOOK and returns to IDLE, you know your call was serviced (of course after having programmatically generated the phone call).
 
Last edited:
Upvote 0

khosrwb

Active Member
Licensed User
Longtime User
Seems like this permission is not documented correctly and can only be used by system apps: Issue 10344 - android - Permission CALL_PRIVILEGED not working as advertised - Android - An Open Handset Alliance Project - Google Project Hosting

You will not be able to directly call emergency numbers.

hi Erel
I do not have access to this link
please help me
how can I automatic telephone call by this code :


B4X:
Sub tel4_Click
   Dim result As Int
      result = Msgbox2("1530", "Vuoi chiamare la guardia costiera ?", "Si", "", "No", Null)
   If result = DialogResponse.Positive Then
   Dim i As Intent
   i.Initialize(i.ACTION_VIEW, "tel:036275735")
   StartActivity(i)
   End If
End Sub


I have add this code in monifest editor :
AddPermission(android.permission.CALL_PHONE)
AddPermission(android.permission.CALL_PRIVILEGED)
 
Upvote 0
Top