Search code examples
androidbluetoothwifi-directgoogle-nearbygoogle-nearby-connections

Nearby Connections max connected devices - clarification


I was searching what is the max number of connected devices and I came across a post that roughly states:

When using P2P_STAR, the max number of devices is 10 as this topoly uses Wi-Fi hotspots. That is, if you don't have a router.

This makes me ask two questions:

  • I know nearby connection uses BLE, Bluetooth and Wi-Fi direct. I know Bluetooth has a max theoretical number of ~7 devices, which are 3-4 real connections. I know that Wi-Fi hotspots have a max of 10 connections. I know BLE can hold up to 20 theoretical connections (although no idea of the number of real connections). If BLE can (theoretically) hold 20 connections and Wi-Fi hotspots 10, why do they say that P2P_STAR limited to 10 if it uses both of these technologies? Maybe BLE only used to discover devices and not to communicate with them?
  • The other question (the important one), is regarding the mention of the router. Nearby connections uses Wi-Fi direct which means the device acts as a router so that other devices may connect to it. Where does an external router come into play here? Can you use an external router with your device and create a hybrid where the device uses Bluetooth and BLE and the router acts as the device's hotspot making it hold more than 10 connections?

EDIT: I was reading about nearby connections in the Google Play Game Services and in the "Before you begin" section, it tells the user to "Connect multiple Android devices to the same WiFi network with multicast enabled."

Can this be a reference to the usage of an external router in nearby connections?


Solution

  • Device Limits

    BLE shares the same 3~4 real-device limit as Bluetooth. However, if that were not the case, then Nearby Connections is programmed to attempt to upgrade as many devices to the higher bandwidth WiFi connection and any remaining devices will continue to be connected over the lower bandwidth BT connection.

    WiFi LAN

    Nearby Connections will utilize the router if it's available to both devices. During the initial advertise/discover phase, it uses mDNS to scan for other devices on the same WiFi network (a Bluetooth scan will happen concurrently, and results are merged). After the initial connection, if it connected over Bluetooth, it shares the SSID of what WiFi network you're connected over and, if both devices are connected to the same SSID (and are reachable), it'll attempt to use that connection instead of setting up a hotspot (since it's less disruptive). It then enables TDLS so that the devices can communicate directly with each other, instead of hopping messages through the router.

    Disclaimer: I work on Nearby Connections