0

Is there a way to query a phone call status with ADB commands?

For instance, I want to see if a phone call is still active while in a phone call or if it is not there (has dropped)

Ducksauce88
  • 640
  • 3
  • 12
  • 26

1 Answers1

6

You could use dumpsys command.

$ adb shell dumpsys telephony.registry

The field mCallState gives the call status:

$ adb shell dumpsys telephony.registry | grep "mCallState"
  1. When in Idle mode:

    $ adb shell dumpsys telephony.registry | grep "mCallState"         
    mCallState=0
    
  2. When call is connected:

    $ adb shell dumpsys telephony.registry | grep "mCallState"         
    mCallState=2
    
  3. When an incoming call (Phone in ringing mode):

    $ adb shell dumpsys telephony.registry | grep "mCallState\|mCallIncomingNumber"
    mCallState=1
    mCallIncomingNumber=+9191XXXXXXXX
    

More information here:

  1. Android TelephonyManager.
  2. TelephonyManager Call States.

Tested on Android v4.4.4

Misc:
You can get a lot of information using dumpsys.
To see what parameters dumpsys support use adb shell dumpsys | grep "DUMP OF SERVICE".

Saurabh Meshram
  • 8,106
  • 3
  • 23
  • 32
  • Very useful information! Note that if you have dual-sim phone you will get two states - one for each SIM slot. – Danijel Jun 23 '20 at 15:40