user604190
user604190

Reputation: 319

How to make a call via pc by ADB command on android?

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.

Upvotes: 31

Views: 69830

Answers (6)

Raghu vamshi Mandala
Raghu vamshi Mandala

Reputation: 15

adb shell input keyevent 5 && adb shell input text 1234567890&&adb shell input keyevent 5

Here 1234567890 is phone number

Upvotes: 0

rbennell
rbennell

Reputation: 1174

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.

Upvotes: 1

Sukirti Dash
Sukirti Dash

Reputation: 119

You can do this one by:

  1. Enter into your adb in cmd
  2. Enter adb devices. What ever id you will get that will be you device number
  3. Enter (Without quotes):

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 }

Upvotes: 9

Diego Torres Milano
Diego Torres Milano

Reputation: 69188

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 }

Upvotes: 48

Harshit Chaurasia
Harshit Chaurasia

Reputation: 319

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
  1. cc=country code
  2. XXXXXXXXXX=Phone Number

Upvotes: 11

Adrian Schneider
Adrian Schneider

Reputation: 1507

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.

Upvotes: 3

Related Questions