speakerphone

cpc6128

Member
Licensed User
Hello all,

Does anyone know of a way to toggle the speakerphone on and off?
I have gone through the registry but can't find anything that looks appropriate.
 

Erel

Administrator
Staff member
Licensed User
Sending the keycode 127 toggles the speakerphone (while speaking). Credits go to Peter Foot's blog: http://peterfoot.net/ProgrammaticallyActivatingSpeakerphone.aspx

If you want to answer a call and automatically activate the speaker you should download this example: http://www.basic4ppc.com/forum/showthread.php?t=1736
And change two of the subs:
B4X:
Sub phone_IncomingCall
    timer1.Enabled = true 'Wait two seconds before pressing the Talk button.
End Sub

Sub Timer1_Tick
    If duringCall Then
        timer1.Enabled = false
        hw.KeyPress(127) 'Toggle the speaker.
    Else
        hw.KeyPress(114) 'Simulate the green Talk button.
        duringCall = true
    End If
End Sub
Otherwise you could just use Hardware.KeyPress(127) with a hardware object.
 

cpc6128

Member
Licensed User
Thanks Erel!

It's odd that there is no (proper) way to do this in code, but a great testament to Peter Foot's ingenuity for providing a decent workaround.
 
Top