I'm trying to find a command in adb shell that lets me turn on the speakerphone when I start a call.

First I make the call

adb shell service call phone 1 s16 "" s16 "#####"

the call starts and I try to start the speakerphone with something like this:

adb shell input keyevent <keycode>

You can use combination of keyevents to achieve the goal. The important ones you would need are:

19 -->  "KEYCODE_DPAD_UP" 
66 -->  "KEYCODE_ENTER" 

See ADB Shell Input Events for more.

According to the interface of your dialer, the combination would vary. E.g.:

adb shell input keyevent 20
adb shell input keyevent 21
adb shell input keyevent 21
adb shell input keyevent 66

It may take more steps, and sometimes, you won't get to see whether it affected the interface or not, but continue combining them, and you would get the result.

That aside, the technique mentioned by Bo Lawson here and taken from this answer by Omar

adb shell service call audio 7 i32 3 i32 0 i32 1

isn't working on my Lollipop at all. Neither it is switching the call into speaker, but adjusting the volume of the earphones only in my Kitkat 4.4.2.

Also, if you intend to use a service call method and the linked answer isn't working, then you may wanna take a look at the source code of the audio service to figure out the things. Find it here.

| improve this answer | |

You might also wanna check out if your phones set up for speaker phone when you turn it over. That could effect whether the commands work.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.