Created
August 10, 2020 05:41
-
-
Save aravindkumarsvg/2a0f8b294d4812680c4243885b86d295 to your computer and use it in GitHub Desktop.
Calling a phone number repeatedly using ADB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Enabling ADB over network | |
# adb kill-server && adb start-server # restart adb server | |
# adb tcpip 5555 # start adb service | |
# adb connect <phone_id> # connect to the device | |
# For enabling loudspeaker and cut the call, make sure to change it based on your phone screen | |
# Ref for getting touch coordinates: https://android.stackexchange.com/questions/164295/how-can-i-see-the-pointer-location-and-simulate-it | |
call () | |
{ | |
adb shell am start -a android.intent.action.CALL -d tel:<tel_phone_number> # make a call | |
sleep 1 | |
adb shell input tap 417 392 # enable loudspeaker ------ Change according to your phone | |
} | |
cut () | |
{ | |
adb shell input tap 250 693 # cut the call ------ Change according to your phone | |
} | |
while :; do | |
while :; do | |
callState=$(adb shell dumpsys telephony.registry | grep mCallState | head -n 1 | sed "s/[^012]\+//g") | |
if [[ "${callState}" == "0" ]]; then | |
break | |
fi | |
sleep 1 | |
done | |
call | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment