android enable disable bluetooth via command line

后端 未结 10 2034
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-05 16:21

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.ac

相关标签:
10条回答
  • 2020-12-05 16:59

    Just use com.intangibleobject.securesettings.plugin. It allows all kinds of bluetooth shenanigans, aswell as conn/disconnecting devices one by one.

    0 讨论(0)
  • 2020-12-05 17:00

    To enable:

    adb shell service call bluetooth_manager 6
    

    To disable:

    adb shell service call bluetooth_manager 9
    

    Tested and worked on a Samsung Galaxy S7.

    0 讨论(0)
  • 2020-12-05 17:02

    To enable

    svc bluetooth enable
    

    To disable

    svc bluetooth disable
    
    0 讨论(0)
  • 2020-12-05 17:05

    For folks who are wondering from where did the numbers 6 and 8 came from. It came from this aidl file: https://android.googlesource.com/platform/system/bt/+/master/binder/android/bluetooth/IBluetoothManager.aidl Start counting from the first function listed in this aidl and you will see the enable function is the 6th one and the disable is the 8th one in the list.

    0 讨论(0)
提交回复
热议问题