监听bluetooth的intent可以获得bluetooth相应的状态。

监听的action有:

<action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />
<action android:name="android.bluetooth.adapter.action.SCAN_MODE_CHANGED" />
<action android:name="android.bluetooth.adapter.action.DISCOVERY_STARTED" />
<action android:name="android.bluetooth.adapter.action.DISCOVERY_FINISHED" />
<action android:name="android.bluetooth.adapter.action.LOCAL_NAME_CHANGED" />

<action android:name="android.bluetooth.device.action.FOUND" />
<action android:name="android.bluetooth.device.action.DISAPPEARED" />
<action android:name="android.bluetooth.device.action.CLASS_CHANGED" />
<action android:name="android.bluetooth.device.action.ACL_CONNECTED" />
<action android:name="android.bluetooth.device.action.ACL_DISCONNECT_REQUESTED" />
<action android:name="android.bluetooth.device.action.ACL_DISCONNECTED" />
<action android:name="android.bluetooth.device.action.NAME_CHANGED" />
<action android:name="android.bluetooth.device.action.BOND_STATE_CHANGED" />
<action android:name="android.bluetooth.device.action.NAME_FAILED" />
<action android:name="android.bluetooth.device.action.PAIRING_REQUEST" />
<action android:name="android.bluetooth.device.action.PAIRING_CANCEL" />
<action android:name="android.bluetooth.device.action.UUID" />

<action android:name="android.bluetooth.headset.action.STATE_CHANGED" />
<action android:name="android.bluetooth.headset.action.AUDIO_STATE_CHANGED" />

<action android:name="android.bluetooth.a2dp.action.SINK_STATE_CHANGED" />

<action android:name="android.bluetooth.devicepicker.action.LAUNCH" />
<action android:name="android.bluetooth.devicepicker.action.DEVICE_SELECTED" />

可以通过Bundle extra = intent.getExra()获得相应intent数据,例如:


Bundle bundle = intent.getExtras();
if (bundle == null) return;
for (String extra : bundle.keySet()) {
Log.d(TAG, "\t " + extra + " = "+ bundle.get(extra));
}

可以得到相应的键值对。

更多相关文章

  1. Android拦截、监听系统返回键事件
  2. Android学习笔记——Android生命周期
  3. 安卓调用键盘回车键做保存或调用搜索键执行操作
  4. 【Android(安卓)进阶】Android(安卓)Home 键监听
  5. Android监听手机软键盘的弹起和关闭
  6. Android之监听手机软键盘弹起与关闭
  7. Android—Android中监听EditText文本输入,实现修改用户名,清除密码
  8. Mono登录界面记住密码的控件
  9. android实现软件指导页

随机推荐

  1. Android实现选择视频功能
  2. Android 实现顶层窗口、浮动窗口
  3. 万物皆可联网——《Android物联网开发从
  4. android 如何使用jar替换java代码编译
  5. 移植facenet pb模型到android
  6. java多线程断点续传
  7. ubuntu14.04上面安装android studio
  8. 开发Android程序使用USB连接真机调试时找
  9. 非root下,如何将android中的数据库文件存
  10. 构建 Android 应用程序一定要绕过的 30