I am trying to enable disable bluetooth on android device using command line.
I can enable it using
adb shell am start -a android.bluetooth.adapter.action.REQUEST_ENABLE
But it prompts user to 'allow' or 'deny'.
I also see there is option to launch ble settings first like
adb shell am start -a android.settings.BLUETOOTH_SETTINGS
and then enable disable adb shell input keyevent **
But it won't be device independent.
To enable:
To disable:
To run commands listed in previous comment, you need to be root:
adb root
Enable:
adb shell service call bluetooth_manager 6
Disable:
adb shell service call bluetooth_manager 8
To enable:
To disable:
Tested and worked on a Samsung Galaxy S7.
On Xiaomi Mi 4i / MIUI 9:
To enable:
To disable:
This can also run within Andorid like: