Foobar
Foobar

Reputation: 8487

How performant is Nearby Connections?

I am using Nearby Connections in my app. I am finding that it takes well over 10 seconds for 2 phones to find and connect to each other. Furthermore, I find that will I can have 2 phones connect to each other--getting more than 3 phones all connected to each other is incredibly hard.

Once the connection is established, performance is pretty stable, but getting the connection established is pretty tricky.

Am I just using Nearby Connections incorrectly? What is the expected performance of Nearby Connections? I have a Pixel 3, a Note 8, and some other recent Samsung phone.

Upvotes: 0

Views: 296

Answers (1)

Xlythe
Xlythe

Reputation: 2033

Bluetooth chips on mobile phones have a theoretical max of 7 connections, but more realistically support 3~4 connections at a time. And to make things worse, Bluetooth headphones (and other Bluetooth devices) count as a connection too.

Note that all strategies will attempt to upgrade to WiFi LAN if they're on the same network, and for P2P_STAR and POINT_TO_POINT the devices will also attempt to upgrade to a WiFi hotspot. Upgrading to WiFi will free up Bluetooth for more connections.

Discovery should, in theory, take 2 seconds. But that number is heavily dependent on the devices, the stability of the Bluetooth stack, and the radio environment. I wish I could give a better real world number, but it's impossible to gather with analytics since we'd need to know exactly when both sides started advertising/discovery. We've been building a test lab, but for various reasons it's not done yet.

Upvotes: 2

Related Questions