Android Question Dial a phone number

Beja

Expert
Licensed User
Longtime User
Hi all,
I am working on a project that I need to dial a number, wait for a few rings and then when the other side hags up, I hangup.
The thing is that, the remote device will check my caller ID and if valid then it hangs up and sends me an SMS message with specific information. I didn't know how to do this with the phone library (dialing and waiting for hangup of other party then hangup)
Any hint or command appreciated.
 

frenkipi

Member
Licensed User
Longtime User
Excuse me, but how about if I want to insert that nomber to dialler, so that the user will have to press the call button?

Thank you!
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
You can use PhoneCalls.Call to make the phone call. The call will be disconnected automatically when the remote device hangs up.

Hi Erel,
Thanks, but I don't know what's wrong with this code:
B4X:
Dim phnsms As PhoneCalls
'......
Sub Button1_Click
    phnsms.Call("PHONE NUMBER")
End Sub

Not dialing.. I am able to dial the device directly from the phone and return the response
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
PhoneCalls.Call returns an Intent.

It should be:
B4X:
StartActivity(phnsms.Call(...))

Thanks Erel.. it's working perfectly now. I wish it was in the background without invoking the Android notification
 
Upvote 0

jGubern

Member
Licensed User
Longtime User
You can use PhoneCalls.Call to make the phone call. The call will be disconnected automatically when the remote device hangs up.

Sure?

Is not my case :(.
The call is not disconnected automatically.
Doesn't exist something like p.stopCall or p.finishCall?

Is there some easy way to end call phone?

Thanks,
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Is there some easy way to end call phone?
On android 7 you can use an Api for call-screening. But i dont think there is a library available for this Api as of today.
 
Upvote 0

jGubern

Member
Licensed User
Longtime User
The call is made with the default dialer app. It should be disconnected automatically.

Thanks Erel,

The end call works fine automatically with another mobile, but not in landline phones......at least in Spain.

I ‘ve used reflection library to solve the problem (r.RunMethod("endCall"),.......) working in a service module.

Regards.
 
Upvote 0
Top