android:接收器在蓝牙设备断开连接时没有收到任何广播

时间:2016-05-13 17:55:47

标签: android bluetooth

我创建了一个接收器,当我的耳机连接到我的测试设备时,我能够收到android.bluetooth.device.action.ACL_CONNECTED,但当我手动断开或关闭耳机时,它没有任何广播。我期待收到" android.bluetooth.device.action.ACTION_ACL_DISCONNECTED"。

我为我的接收器声明了这些意图过滤器:

            <action android:name="android.bluetooth.adapter.action.DISCOVERY_FINISHED" />
            <action android:name="android.bluetooth.device.action.ACL_CONNECTED" />
            <action android:name="android.bluetooth.device.action.ACTION_FOUND" />
            <action android:name="android.bluetooth.device.action.ACTION_ACL_DISCONNECT_REQUESTED" />
            <action android:name="android.bluetooth.device.action.ACTION_ACL_DISCONNECTED" />

其他信息:我的测试设备正在运行android 6.

知道为什么吗?还是我错过了什么?

感谢。

1 个答案:

答案 0 :(得分:0)

有一个拼写错误,应该是行动(字符串中没有ACTION_):

<action android:name="android.bluetooth.device.action.ACL_DISCONNECTED" />