I am working on a testing tool and I am able to initiate and terminate voice call from default Dialer app in android using following commands.
adb shell am start -a android.intent.action.CALL -d tel:+919999999999
adb shell input keyevent KEYCODE_ENDCALL
I need to enable Speakerphone through adb interface after initiating voice call. How can I achieve this? My android device may not have root permission.
Related
Is there anyway an app could detect if it was launched (or killed) via an ADB command line code from an attached computer vs physically tapping the actual app icon on the screen?
And/or could it tell if a tap input in the app was done by a physical tap vs an ADB input?
Launch command: adb shell monkey -p -c android.intent.category.LAUNCHER 1
Kill command: adb shell am force-stop
Tap command: adb shell input tap
adb command is running in a brandnew process of system/bin/sh. It is difficult to achieveļ¼even if the device is rooted.
You maybe need handle touch events via getevent command. adb shell input will skip the input device to simulate user action, but if someone uses the adb shell sendevent command, you will not be able to detect it.
I am working on automating bluetooth actions on android like enable/disable, pairing/unpairing devices etc.
I want to know how to interact with unrooted android device for above mentioned bluetooth operations using adb shell commands or android intents.
For example, i want to know which devices are bluetooth paired with my android phone using adb shell commands.
is it possible?
dumpsys is your friend:
Find your bluetooth service (must be running): adb shell dumpsys -l
Mine is bluetooth_manager, so I run: adb shell dumpsys bluetooth_manager
In output you can find section "Bonded devices"
Lets take a simple example.
My android real device is connected to PC via USB and ADB is connected.
I used
D:\Test>adb shell input keyevent 29
to enter A
I want to implement a PERL script for this and want to execute same functionality using
C:\Perl\bin>perl t.pl
I tried:
t.pl content:
system("adb shell input keyevent 29");
It say adb is not recognized command
The code you have written should work, unless your ADB is configured in environment variable. Try the script using your android device id.
Once you configure the environment variable of ADB, do this.
D:\Test>adb devices
Once you get the device ID, try the following code in your perl script.
system("adb -s <device id> shell input keyevent 10");
P.S: I tried with 10 keyevent using dialer to check which key press in number 10. It presses number 3 from the dialpad.
I am working on automating bluetooth actions on android like enable/disable, pairing/unpairing devices etc.
I want to know how to interact with unrooted android device for above mentioned bluetooth operations using adb shell commands or android intents.
For example, i want to know which devices are bluetooth paired with my android phone using adb shell commands.
is it possible?
dumpsys is your friend:
Find your bluetooth service (must be running): adb shell dumpsys -l
Mine is bluetooth_manager, so I run: adb shell dumpsys bluetooth_manager
In output you can find section "Bonded devices"
I tried to toggle Bluetooth from Terminal with the following command as root:
'service call bluetooth 3' for enable
'service call bluetooth 4' for disable
But I get the error
service: service bluetooth does not exist
I searched for bluetooth in the server list and there's only bluetooth_manager
I have a rooted Nexus 5 (Android 4.4).
Is there any other way to toggle Bluetooth via Terminal?
Maybe with 'am start com.android.settings....' ?
What I want to do is enabling Wifi and disable Bluetooth at the same time and reverse.
For Wifi there's no problem with svc wifi enable/disable
As root using service call:
adb shell su -c service call bluetooth_manager 6 turn bluetooth on
adb shell su -c service call bluetooth_manager 8 turn bluetooth off
Details of bluetooth_manager in android.bluetooth.IBluetoothManager.
Or as non-root using keyevents:
adb shell am start -a android.settings.BLUETOOTH_SETTINGS
adb shell input keyevent 19
adb shell input keyevent 23