Android的蓝牙 - 确定是否配对的设备是'上' [英] Android Bluetooth - Determine if a paired device is 'on'

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

问题描述

我想,以确定是否已配对设备当前有效。我并不真的需要连接到它,只是确定它是否有心跳。

I want to determine if a paired device is currently active. I don't really need to connect to it, just determine if it has a heartbeat.

我打了一系列的IO错误,同时试图连接蓝牙接口,但我不知道我真的需要。

I'm fighting a series of IO errors while trying to connect a bluetooth socket, but I'm not sure I really need to.

推荐答案

假设你正在使用的Andr​​oid
如果你有一个BluetoothDevice类对象这个设备,你可以注册侦听广播动作 - ACL_CONNECTED或ACL_DISCONNECTED并跟踪连接状态的

Assuming you are using Android If you have a BluetoothDevice object to this device, you can register to listen for the Broadcast Actions - ACL_CONNECTED or ACL_DISCONNECTED and keep track of the connection state.

这篇关于Android的蓝牙 - 确定是否配对的设备是'上'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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