I would like to make call via ADB command on android\'s command line.
How should I use ADB command in order to make a call via PC?
please provide source code
You should do (replace <serialno> by the serial number of your device or emulator, for example emulator-5554):
$ adb -s <serialno> shell am start -a android.intent.action.CALL -d tel:555-5555
and see this in the logcat:
Starting: Intent { act=android.intent.action.CALL dat=tel:xxx-xxx-xxxx }
You can do this one by:
adb -s "Your devices number" shell am start -a android.intent.action.CALL -d tel:"phone no. to call"
That's it and you will get the response as:
Starting: Intent { act=android.intent.action.CALL dat=tel:xxxxxxxxxx }
adb shell input keyevent 5 && adb shell input text 1234567890&&adb shell input keyevent 5
Here 1234567890 is phone number
On some Android devices, there exists an executable
/system/bin/radiooptions
If you run it, the help dislplays
Usage: radiooptions [option] [extra_socket_args]
0 - RADIO_RESET,
1 - RADIO_OFF,
2 - UNSOL_NETWORK_STATE_CHANGE,
3 - QXDM_ENABLE,
4 - QXDM_DISABLE,
5 - RADIO_ON,
6 apn- SETUP_PDP apn,
7 - DEACTIVE_PDP,
8 number - DIAL_CALL number,
9 - ANSWER_CALL,
10 - END_CALL
For dialing a number, you can simply run
adb shell su -c "radiooptions 8 XXXXXXX"
where XXXXXXX is to be replaced by the phonenumber.
I saw this command on quite many HTC devices. I run currently a Cyanogenmod 10.2 on an HTC One, and there it is as well. It could also be possible, that it is only available on devices with a Qualcomm radio chip.
One can use this command make a call to a number via Android triggered by PC.
adb shell am start -a android.intent.action.CALL -d tel:+CCXXXXXXXXXX
you can launch the dialler, by first finding the package using
adb shell dumpsys window windows | grep -E 'mCurrentFocus'
then launching it using
adb shell monkey -p <package> 1 (probably com.android.contacts)
ensure you're on the dialler and not the contacts page by clicking the coordinates of the dialler
adb shell input tap <x> <y> (in my case 65, 80)
type the number
adb shell input text <number>
and then hit the dial coordinates
adb shell input tap <x> <y> (in my case 220, 750)
For sure this answer is overkill. However, all of the previous answers i've encountered will then launch a dialog asking which application you wish to use to complete the action - skype, viber, etc., meaning if you have either not chosen a default dialler but have ott calling apps installed, or else have specified an alternative default dialler, the call will not be made over gsm. This method will ensure that gsm is used.