TestProject Forum

Way to disable/enable bluetooth in android

Hello community testproject
Please help me solve the problem. I need to test the application without connecting to bluetooth, and for this, before starting the test, check and disable (if necessary) the bluetooth setting of the device. I need to write a test for each tested device with disconnection steps in the settings, or is there some kind of universal way to disable / enable bluetooth in android.
Thanks, I hope for help

Hi @zeleznov.sergey,
You can use the action Execute Android shell command and run these commands

To turn on bluetooth :
adb shell am broadcast -a io.appium.settings.bluetooth --es setstatus enable

chrome_mAAHwNjMUs

To turn off bluetooth :
adb shell am broadcast -a io.appium.settings.bluetooth --es setstatus disable

Please let me know if that solved your issue.

1 Like