我正在开发一个与蓝牙设备连接的应用程序,该设备工作在超高速以太网(BluetoothHeadset)协议上。
蓝牙耳机通过蓝牙HFP发送AT(ACTION_VENDOR_SPECIFIC_HEADSET_EVENT)指令。我已经成功地在设备之间建立了连接。
我已经编写了一个广播接收器,并在清单中注册了它。
<receiver
android:name=".BluetoothReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />
<action android:name="android.bluetooth.device.action.BOND_STATE_CHANGED" />
<action android:name="android.bluetooth.headset.profile.action.CONNECTION_STATE_CHANGED" />
<action android:name="android.bluetooth.headset.action.VENDOR_SPECIFIC_HEADSET_EVENT" />
<action android:name="android.bluetooth.headset.profile.action.AUDIO_STATE_CHANGED" />
</receiver>上述接收器适用于广播中提到的所有操作和触发器,但
"android.bluetooth.headset.action.VENDOR_SPECIFIC_HEADSET_EVENT".
我无法接收供应商特定的头戴式耳机事件。蓝牙设备通过上述操作发送数据。我参考了以下文档
https://developer.android.com/reference/android/bluetooth/BluetoothHeadset.html
发布于 2018-07-12 19:54:14
您确定是头戴式耳机服务广播它吗?您可以在Android源代码存储库中查看特定于供应商的AT命令在您的Android版本中是如何处理的。例如,HeadsetStateMachine of Android 8.1上的processUnknownAt
Upd:顺便说一下,你真的没有意图过滤器结束标签吗?
Upd2:因为他们在意图中使用带有companyid的addCategory,所以你可能也需要在你的清单中描述所有需要的类别。
https://stackoverflow.com/questions/51301244
复制相似问题