简体   繁体   English

与远程蓝牙设备断开连接时如何在android java中生成警报

[英]how to generate alert in android java when connection is lost with remote bluetooth device

I need alert for device paired to android phone in case when it gets out of range from phone Bluetooth. 我需要为与Android手机配对的设备发出警报,以防设备超出手机蓝牙的范围。 I worked on it and got something about rss can any one help me out. 我做了一些工作,得到了有关rss的信息,任何人都可以帮助我。 do i need to send any character to check connection. 我是否需要发送任何字符来检查连接。

If you have the connection then you are probably blocking on the read() of the InputStream which will throw an IOException when the connection drops. 如果有连接,则可能是阻塞了InputStream的read(),当连接断开时,它将抛出IOException。 Catch that and handle correctly. 抓住并正确处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM