Android的 - 蓝牙设备连接播放 [英] Android - Bluetooth device connected broadcast

查看:121
本文介绍了Android的 - 蓝牙设备连接播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想有一个广播接收器监听连接BT的设备。
有谁告诉我哪广播我要听?
我试图 android.bluetooth.device.action.ACL_CONNECTED ,但它似乎并没有工作。

I want to have a broadcast receiver listening for BT devices connecting. Could anybody tell me which broadcast I have to listen to? I tried android.bluetooth.device.action.ACL_CONNECTED but it doesn't seem to work.

感谢您。

推荐答案

您可以通过使用 BroadcastReceiver.onReceive()函数里以下拉设备:

You can pull the device by using the following inside your BroadcastReceiver.onReceive() function:

BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);

这篇关于Android的 - 蓝牙设备连接播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆