Google Nearby Messages - Cancel initial link between devices

痞子三分冷 提交于 2019-12-04 02:13:03

问题


I'm building a app to test Google Nearby Messages API. For that test, I'm using DISTANCE_TYPE_EARSHOT.

According to this thread Nearby API's Strategy.DISTANCE _TYPE_ EARSHOT doesn't seem to restrict message proximity , after the initial link between devices, they can receive messages for 10 minutes regardless of distance. I would like to know if this 10 minute limit can be interrupted (in order to prevent that a device can receive a message when its distance to another device is more than ~5ft - EARSHOT).

Alternatively, is there a way to get the distance between devices?

Thank you.


回答1:


(I work on the Nearby API)

Today, Nearby doesn't expose distance directly nor does it provide a way to force "un-pairing" of devices programmatically. We've heard folks want both of these things, the features are on our radar, but we can't comment or commit beyond that.

As a manual hack, you can clear data on "Google Play Services" to un-pair devices.

You can get a rough approximation of distance by measuring BLE RSSI if one of the devices is capable of BLE advertising. This will be sensitive to how the device is held, antenna gain and environmental factors but better than random.

There's not a straight-forward "tape measure" API, though.



来源:https://stackoverflow.com/questions/33001812/google-nearby-messages-cancel-initial-link-between-devices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!