android enable disable bluetooth via command line

后端 未结 10 2056
佛祖请我去吃肉
佛祖请我去吃肉 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:43

    As awm129 has pointed out, solutions using service call aren't device-independent. While I am unable to completely eliminate the use of service call, the following solution should be more device-independent:

    To disable:

    pm disable com.android.bluetooth
    

    To enable:

    pm enable com.android.bluetooth
    service call bluetooth_manager 6
    

    I hope someone will eventually find a service call-free solution.

提交回复
热议问题