ADB command Enable/Disable NFC for MOS - android

I'm trying to create a batch file to test for NFC on/off, so I went to the following post to figure out how to programmatically turn NFC on/off using adb command on MOS device:
Enable/Disable NFC with ADB command
Turning on the NFC worked using the following command : adb shell service call nfc 6.
However, turning off NFC isn't working. I tried the following commands:
adb shell service call nfc 0
adb shell service call nfc 1
adb shell service call nfc 2
adb shell service call nfc 3
adb shell service call nfc 4
adb shell service call nfc 5
adb shell service call nfc 7
adb shell service call nfc 8
adb shell service call nfc 9
but none of them worked. "adb shell service call nfc 5" worked in L-OS device, but not in MOS device. How can I turn off NFC using adb command in MOS device? What changes did Google make?

I searched and found this on XDA. Maybe you should give it a try.
NFC POWER OFF
echo 0 > /sys/devices/platform/nfc-power/nfc_power 0<&- &>/dev/null 2>&1

Related

ADB shell bluetooth commands [duplicate]

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"

Is it possible to use adb to take a screenshot of a wearable connected via bluetooth?

I have an LG watch which I can connect directly to my developer machine using USB and therefore can use the following command to take screenshots:
adb shell screencap -p /sdcard/screenshot.png
However my Moto 360 watch doesn't have a usb connection and thus I have to connect it using bluetooth going via its paired handset. This means there are always two devices connected to adb. Thus its not possible to use the adb shell command as adb doesn't know which device to apply it to. Some adb commands can have the device specied, but it doesn't look like this is possible with adb shell.
Using the Take wearables screenshot menu option in the Android Wear app isn't doing anything - it says "Screenshot request sent" but then nothing after that.
So how can I grab a screenshot of the watch? (I want to take a screenshot when there is an incoming phone call)
Enable bluetooth debugging on your wearable and setup a debugging session (described here: Debugging over Bluetooth).
You have to run any adb command in the following format:
adb -s localhost:4444 <command>
A simple
adb -s localhost:4444 shell screencap -p /sdcard/screenshot.png
adb -s localhost:4444 pull -p /sdcard/screenshot.png
should do the trick ;)

How to control bluetooth operations using adb shell?

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"

Is there an ADB command to enable/disable mobile data?(Rooted Device)

I'm looking for an adb shell command to enable/disable mobile data. The app is only being tested on rooted devices so I have adb root privileges. I looked around and found that wifi can be enabled/disabled with:
$ adb shell svc wifi enable
$ adb shell svc wifi disable
These work for me but I wasn't able to find anything for mobile data.
Any reference to a list of adb shell svc commands that can be performed would be appreciated as well. I know there's a list of key input commands from this question and obviously I'm aware of the developer page but there's no mention of svc.
Lastly, what is svc?
I found the answer to my question:
To enable mobile data:
$ adb shell svc data enable
To disable mobile data:
$ adb shell svc data disable

Android 4.4 Service Bluetooth does not exist

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

Categories

Resources