Google Nearby Connections Limit to Earshot Distance?

376 views Asked by At

So I am working with trying to transfer data between two phones with Google Nearby Connections.

For example, say I want to transfer a variable from each phone to another and then show a toast containing the text from the other phone.

I have been looking into the Connections API but I can't seem to limit it to when two phones are really close to each other. I have seen that the Nearby Messages API has an Earshot distance option.

But there isn't an option for earshot distance in the Nearby Connections API since the Nearby messages API doesn't seem to contain what I need to make something like the example above work.

Hope you can help me :)

3

There are 3 answers

14
Xlythe On

There hadn't been a feature request for it until now, which is why there's no support in Nearby Connections.

I believe Nearby Messages would support your use case, though. It can exchange a few KB of data to other devices nearby. It's not a live bi-directional channel, like Nearby Connections is, but it doesn't sound like you need that.

6
afarre On

Nearby connections uses bluetooth, BLE (Bluetooth Low Emissions) and WiFi. This signals can't be adjusted to reach a certain distance.

Nearby messages, on the other hand, also uses ultrasounds which can limit the phone's reach to a much shorter distance. See this video. It's also stated in the documentation of messages.

So your options are either fully offline connections without distance setting, or online messages with distance setting. Note that messages is not fully online, it only publishes the message to be shared in a google server. The key necessary to retrieve that message is sent offline between users.

0
daparic On

I believe that your precise requirement for distance is what is being addressed in this Bluetooth Core Specification 5.1. Therefore, the solution is pending on:

  • Bluetooth hardware chips 5.1 will happen
  • Smartphone manufacturer will use these chips
  • Android Bluetooth library is updated to exploit the new feature of this chip