简体   繁体   中英

How to send a keystroke through adb during a phone call?

I would like to be able to use ADB to fully manage the process of a phonecall (primarily as I have cracked my screen and cannot see anything).

I know I can initiated a phonecall through:

adb shell am start -a android.intent.action.CALL -d tel:1234567890

Similarly I know I can use key events to end a call:

adb shell input keyevent KEYCODE_ENDCALL

However I have run into issues when the voicemail asks "press 1 to listen to your message, 2 for settings, etc".

I was hoping that the following command would work:

adb shell input keyevent KEYCODE_1

or at least the following:

adb shell sendevent /dev/input/event0 1 2 1
adb shell sendevent /dev/input/event0 1 2 0

However the voicemail does not recognise the selection and just repeats the message. I have no way to validate visually as I have no access to the screen.

Any suggestions?

Thanks for your help.

References:

  1. Making a call through adb How to make a call via pc by ADB command on android?
  2. Input event and events' list ADB Shell Input Events
  3. Send event https://groups.google.com/forum/?fromgroups=#!topic/android-beginners/il2PqSKRFNI

在通话期间,您需要切换到“拨号盘”标签,以便发送DTMF代码

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM