Android的Blutooth配对 [英] Android Blutooth pairing
问题描述
有没有用的范围配对设备相关联的动作。即可以通过我们的广播接收器每当一个已经配对的设备进来的范围,将被触发的动作听。
Is there an action that is associated with "Paired device in Range". i.e can we listen through a Broadcast receiver for an action that would be triggered whenever an already paired device comes in range.
如果没有直接实现这一目标的行动,难道还有比通过扫描不断轮询其他的方式(看是否有在范围内绑定设备)?
If there are no actions that directly achieve this, is there a way other than constantly polling by scanning (and see if there are bonded devices that are in range)?
推荐答案
没有因为蓝牙无线电必须以知道是谁的周围进行搜索会话。
No because the Bluetooth radio has to perform a discovery session in order to know who's around.
一种可能性是注册一个设备发现广播接收机和以一定间隔执行发现会话。然后每个被发现会拉开的广播设备,和你的特殊广播接收器可以看一下这些设备属性,以确定它是否是我们已经与已经或不配对的装置。
One possibility would be to register a "device found" broadcast receiver and perform a discovery session at an interval. Each device that is discovered will kick off a broadcast, and your special broadcast receiver can then look at those device properties to determine whether it is a device which we have paired with already or not.
请记住蓝牙发现是一个资源密集的过程(在高占空比,高功率发射),如果使用过于频繁提出一个显著消耗在电池上。
Keep in mind bluetooth discovery is a resource intensive process (transmits at a high duty cycle, high power) and puts a significant drain on the battery if used too often.
这篇关于Android的Blutooth配对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!