导航:首页 > 安装管理 > 安卓获取已连接的蓝牙设备

安卓获取已连接的蓝牙设备

发布时间:2021-07-31 17:20:54

Ⅰ android 怎么判断远程蓝牙设备已连接

BluetoothHeadset mBluetoothHeadset;

// Get the default adapter
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

// Establish connection to the proxy.
mBluetoothAdapter.getProfileProxy(context, mProfileListener, BluetoothProfile.HEADSET);

// Define Service Listener of BluetoothProfile
private BluetoothProfile.ServiceListener mProfileListener = new BluetoothProfile.ServiceListener() {
public void onServiceConnected(int profile, BluetoothProfile proxy) {
if (profile == BluetoothProfile.HEADSET) {
mBluetoothHeadset = (BluetoothHeadset) proxy;
}
}
public void onServiceDisconnected(int profile) {
if (profile == BluetoothProfile.HEADSET) {
mBluetoothHeadset = null;
}
}
};

//call functions on mBluetoothHeadset to check if Bluetooth SCO audio is connected.
List<BluetoothDevice> devices = mBluetoothHeadset.getConnectedDevices();
for ( final BluetoothDevice dev : devices ) {
return mBluetoothHeadset.isAudioConnected(dev);
}

// finally Close proxy connection after use.
mBluetoothAdapter.closeProfileProxy(mBluetoothHeadset);

Ⅱ android 获取的蓝牙设备信息吗

Android对于蓝牙开发从2.0版本的sdk才开始支持,而且模拟器不支持,测试至少需要两部手机,内所以制容约了很多技术人员的开发。
android蓝牙开发 蓝牙设备的查找和连接
http://blog.csdn.net/centralperk/article/details/8080908

Ⅲ android 怎么查看蓝牙设备

安卓系统的平板电脑,在设置里面可以查看到蓝牙地址。手机查询蓝牙地址的话,专在拨号键盘上键属入:*#2820#
查询
蓝牙
mac
地址。现在也可来查一下啦~步骤如下:
(1)在主屏幕上轻按“设置”按钮。或者,按下物理按钮“menu”,选择“设置”。
(2)在设置的列表下,轻按选择“关于本机”按钮。
(3)然后,轻按“状态消息”按钮。
(4)查看“蓝牙地址”注意:
必须开启蓝牙,才能查看到蓝牙地址。编者按:
安卓系统平板电脑中蓝牙地址,对于普通用户,很少能用得着。蓝牙地址可以说是连接到设备的唯一通
道,通过识别协议,可实现设备间的数据传输。一般,我们用不着,但如果有人问你查询“蓝牙地址”,你就可以告诉他。

Ⅳ 这段 安卓软件中的代码中如何判断 手机是否连接到 蓝牙设备

安卓蓝牙中抄。要连接其他设备要调用袭connect()函数。。此函数你可以去看一下,官方说的是:若连接成功,就不会产生异常。不成功,就会产生异常。。。所以看看程序会运行异常不。运行了,说明没有连接成功。没运行,则连接成功了。
try {
// 连接
connect(device);
} catch (IOException e) {
Toast.makeText(MainActivity.this, "没有成功连接设备", //1
Toast.LENGTH_SHORT).show();
}

若成功了,不会运行1,不成功,就会产生异常。运行异常中的程序,也就是代码1.

Ⅳ 通过android代码如何实现手机蓝牙自动连接最后一次已配对的设备

先明确场景。你是希望如下哪种自动连接?

case1: 手机开机自动连接蓝牙最后配对设备:Android已经在Framework层实现。不需要Apk再做。关键代码如下:

.java 里面

onReceive 收到事件BluetoothAdapter.STATE_ON后

else if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(action)) {

initiateConnection();给状态机发CONNECT

.sendMessage(.CONNECT);


case2:蓝牙关闭状态,打开蓝牙,自动连接最后使用的设备:Apk层注册监听蓝牙打开的广播,然后在事件响应中获取已配对列表,取第一个去进行连接就好。

  1. 注册监听蓝牙打开的广播事件:android.bluetooth.adapter.action.STATE_CHANGED

    Bluetooth ACTION_STATE_CHANGED curState = 11,preState = 10 打开中

    Bluetooth ACTION_STATE_CHANGED curState = 12,preState = 11 打开了。

  2. 获取已配对设备列表:BluetoothAdapter.getBondedDevices()

  3. 取出第一个设备(也就是最新的),连接:

    framework/base/core/java/android/bluetooth/

    BluetoothHeadsetClient: connect(device)

    BluetoothA2dpSink: connect(device)

Ⅵ 安卓手机如何快速删除已连接的蓝牙设备

手机蓝牙目前还没有能一键删除已连接的蓝牙设备记录的功能,只能一个一个【取内消配对】。


手机桌面,向容下拉选择快捷蓝牙。或者在手机设置中找到蓝牙并打开。


【蓝牙】

蓝牙(Bluetooth®):是一种无线技术标准,可实现固定设备、移动设备和楼宇个人域网之间的短距离数据交换(使用2.4—2.485GHz的ISM波段的UHF无线电波)。

Ⅶ android如何获得已配对设备的蓝牙mac地址

//获取已经保存过的设备信息内
Set<BluetoothDevice> devices = mBluetoothAdapter.getBondedDevices();
if (devices.size()>0) {
for(Iterator<BluetoothDevice> iterator=devices.iterator();iterator.hasNext();){
BluetoothDevice bluetoothDevice=(BluetoothDevice)iterator.next();
System.out.println("设备:容"+bluetoothDevice.getName() + " " + bluetoothDevice.getAddress());
}
}

Ⅷ 安卓手机如何快速删除已连接的蓝牙设备

手机蓝牙目前还没有能一键删除已连接的蓝牙设备记录的功能,只能一个一个【取消配对】。

Ⅸ android下如何查看已连接的蓝牙设备

;

//Getthedefaultadapter
=BluetoothAdapter.getDefaultAdapter();

//Establishconnectiontotheproxy.
mBluetoothAdapter.getProfileProxy(context,mProfileListener,BluetoothProfile.HEADSET);


//
privateBluetoothProfile.=newBluetoothProfile.ServiceListener(){
publicvoidonServiceConnected(intprofile,BluetoothProfileproxy){
if(profile==BluetoothProfile.HEADSET){
mBluetoothHeadset=(BluetoothHeadset)proxy;
}
}
(intprofile){
if(profile==BluetoothProfile.HEADSET){
mBluetoothHeadset=null;
}
}
};


//.
List<BluetoothDevice>devices=mBluetoothHeadset.getConnectedDevices();
for(finalBluetoothDevicedev:devices){
returnmBluetoothHeadset.isAudioConnected(dev);
}


//.
mBluetoothAdapter.closeProfileProxy(mBluetoothHeadset);

Ⅹ 如何查看安卓手机中已配对蓝牙设备信息

在手机中找到设置---点开-----一般会在WLAN 下面----蓝牙----打开 可以看到各种蓝牙已应用的信息

阅读全文

与安卓获取已连接的蓝牙设备相关的资料

热点内容
黑龙江特种设备检验研究院 浏览:210
机械化养护中心 浏览:838
上海特种设备管理 浏览:48
机械师改枪 浏览:181
机械化剪纸 浏览:757
美燃环保设备 浏览:809
济南北斗星数控设备有限公司 浏览:838
自动喷涂机械手 浏览:457
中小型农业机械加工项目建议书 浏览:251
不锈钢加工设备市转让 浏览:441
水稻生产全程机械化 浏览:110
扳手机械原理 浏览:61
凯格精密机械有限公司 浏览:61
广毅机电设备 浏览:805
重庆三阳办公设备有限公司 浏览:494
华技达自动化设备 浏览:631
东莞石碣自动化设备厂 浏览:131
机械制图陈列柜 浏览:246
郑州奥鑫游乐设备公司 浏览:733
美邦环保设备有限公司 浏览:386