简体   繁体   English

用于检测Wear手表与Android手机之间距离的API?

[英]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.

相关问题 Android手机上安装第三方应用程序是否有办法破解Android手机和Android Wear手表之间的数据? - Is there any way for 3rd party apps installed on Android phone to hack data between Android phone and Android Wear watch? Android Wear(手表)。 有没有办法检测磨损是否与任何设备相连,仅仅是磨损? - Android Wear(Watch). Is there any way to detect that wear is connected to any device or not, from the wear only? 来自Android Wear手表的通用Android手机音乐控件 - General purpose Android phone music controls from Android Wear watch 如何检测安卓设备是否与安卓手表配对 - How to detect if android device is paired with android wear watch Android Wear Watch Face获取手机的电池百分比 - Android Wear Watch Face get battery percentage of Phone 如何在Android Wear上录制音频? 可在手机上使用,无法在手表上使用 - How to record audio on android wear? Works on phone, not on watch 从手表向手机Android Wear传输数据的最快方法是什么 - What is the fastest way to transfer data from watch to phone Android wear 手表未收到手表发送的Android Wear消息 - Android Wear message sent from watch is not received by the phone devie Android Wear:获取手机电池电量以显示在表盘上 - Android Wear: Get phone battery level for display in watch face 如何检测手表中是否已安装我的Android应用的Wear应用 - How to detect if the Wear app of my Android app is already installed in the watch
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM