Android Question Press Key while in Phone Call from App

aaronk

Well-Known Member
Licensed User
Hi,

I am trying to make a phone call within my app but display my app while the phone call is being made and then when the call is answered to press some keys.

I have been able to do some of this so far using the PhoneEvents in a service like below:

B4X:
Sub Process_Globals
    Dim PE As PhoneEvents
End Sub

Sub Service_Create
    Dim PhoneId as PhoneId
    PE.InitializeWithPhoneState("PE",PhoneId)
End Sub

Sub Service_Start

End Sub

Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
    If State = "OFFHOOK" Then StartActivity(PhoneUI)
End Sub
Sub Service_Destroy
   
End Sub
The above will detect if the call is being made..
So from a Activity (such as the Main Activity) I have a button that will call a phone like:

B4X:
Sub Button1_Click
    Dim ph as PhoneCalls
    StartActivity(ph.call("12345678")) ' Replace this with the number I want to call
End Sub
However lets say the person at the other end answers the call but I want to press 123 while in the call. (bit like VoiceMail where you press a key to delete the VoiceMail)

Is there a way within my app and while the call is answered to press 123 as I haven't been able to work it out ?
 
Top