[英]API to detect distance between Wear watch & Android phone?
In my application, we want to warn the user when he is at distance from Phone or watch. 在我的应用程序中,我们希望在用户离手机或手表较远时向用户发出警告。
We are scanning nearest nodes using APIs of wear OS. 我们正在使用Wear OS的API扫描最近的节点。
Is there any way I can detect the distance between two such nodes? 有什么办法可以检测两个这样的节点之间的距离?
Getting geolocation of both & calculate distance using formula is one possible way. 获取两者的地理位置并使用公式计算距离是一种可能的方法。
But aren't the APIs on wear OS has something which can detect distance using Bluetooth range or signal strength? 但是,穿戴式OS上的API是否不具备可以通过蓝牙范围或信号强度检测距离的功能?
The best that's directly supported by the platform is the Node API's isNearby
method , but that essentially just returns true iff the phone-watch connection is over Bluetooth rather than cellular or wifi. 平台直接支持的最好的方法是Node API的isNearby
方法 ,但是只要电话手表的连接是通过蓝牙而不是通过蜂窝或wifi进行的,那么该方法实际上只会返回true。 It doesn't give you anything resembling a real distance number. 它不会给您任何类似于真实距离的数字。
Beyond that, you'd have to roll your own solution using GPS on both devices, as you mention. 除此之外,正如您提到的,您还必须在两个设备上使用GPS推出自己的解决方案。 But that has a lot of downsides: complexity, reliability, and battery use are ones that immediately occur to me. 但这有很多缺点:复杂性,可靠性和电池使用是我立即想到的。 Someday, you'll be able to get this kind of accuracy from the fused location provider using wifi , but probably not for some years. 总有一天,您将能够使用wifi从融合的位置提供程序中获得这种准确性,但可能有几年没有了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.