【问题标题】:bluetooth adapter action not found找不到蓝牙适配器操作
【发布时间】:2015-08-30 15:10:04
【问题描述】:
我在清单文件中静态注册广播接收器,我想在启用连接时接收通知。我参考了android开发者网站here
它说我必须使用以下内容:
Constant Value: "android.bluetooth.adapter.action.REQUEST_ENABLE"
在我的清单文件中,我添加了以下内容,但没有名为 REQUEST_ENABLE 的内容:
<action android:name="android.bluetooth.adapter.action.XXXX" >
请告诉我如何使用它。
【问题讨论】:
标签:
android
android-intent
bluetooth
broadcastreceiver
intentfilter
【解决方案1】:
如果您想知道蓝牙适配器何时打开/关闭,我认为您应该使用 android.bluetooth.adapter.action.STATE_CHANGED。
还有几个问题要问您:
1. 您可以尝试使用定义的此权限进行构建(即使出现错误)并显示您的代码以及错误?
2.你用的是android studio,Eclipse吗?
3. 你的 min/target/compile sdk 版本是什么(或 Eclipse 中的项目构建目标)
【解决方案2】:
如果您想在连接时收到通知。您应该使用:
<action android:name="android.bluetooth.device.action.ACL_CONNECTED"/>
如果你想收到关于打开/打开/关闭的状态,你应该使用:
<action android:name="android.bluetooth.adapter.extra.STATE"/>