When I place a call and the Bluetooth is connected to my car, I see a button to select where to route the call's audio (car / phone).
Please, where could I find the relative values to use with the code that Erel already provided (I don't find those values on developer.android)
B4X:
Dim r As Reflector
r.Target = r.GetContext
r.Target = r.RunMethod2("getSystemService", "audio", "java.lang.String")
Dim mode As Int
If Value Then mode = 2 Else mode = 0
r.RunMethod2("setMode", mode, "java.lang.int")
The only way that works for me (note 3 with KitKat) is this code :
B4X:
Dim r As Reflector
r.Target = r.GetContext
r.Target = r.RunMethod2("getSystemService", "audio", "java.lang.String")
Dim mode As Boolean
mode=True
r.RunMethod2("setSpeakerphoneOn", mode, "java.lang.boolean")
DoEvents
mode=False
r.RunMethod2("setSpeakerphoneOn", mode, "java.lang.boolean")