How can I speed up making a connection with the Nearby Connections API?

34 views Asked by At

I'm developing an app for Android using Nearby Connections. I'm using the P2P Cluster strategy, and using a model where each device is advertising and discovering and requests a connection to every other device.

When a device A tries to connect to device B, it takes a fairly long time for the connection to succeed. When I connect multiple devices, each device cannot consistently detect and connect to all the other devices.

I've narrowed down the delay to forming the connection itself, and not sending messages. Other things I want to do like transmitting messages or detecting endpoints function.

I'm not sure why this is happening. I've checked this answer on thrashing when both devices try to connect to each other, but when I switched to a model where both devices were advertising and discovering but only one device requested a connection, I still got significant delay beyond the 2-7 s stated there.

0

There are 0 answers