adb 命令操作蓝牙

本文转载于:https://www.cnblogs.com/liuliu-word/p/10910662.html


使用adb命令操控Android手机

打开和关闭蓝牙BT:

adb root
adb shell svc bluetooth enable
adb shell svc bluetooth disable

查询蓝牙开启状态:

adb shell settings get global bluetooth_on

=》0: 未开启    1: 已开启

获取mac地址:

方法1:

adb shell settings get secure bluetooth_address

=》如:00:00:00:00:00:01

方法2:

adb shell adb shell service call bluetooth_manager 13

其中: bluetooth_manager: [android.bluetooth.IBluetoothManager] 是 Bluetooth 相关 services 提供给上层的接口。

13 是IBluetoothManager接口中的第13个方法:String getAddress();(注:该值不同平台可能不一样,最终根据IBluetoothManager.aidl确定。 在/system/bt/binder/android/bluetooth/ 或 /frameworks/base/core/java/android/bluetooth/下)

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值