Wi-Fi vs Bluetooth for peer to peer connection

Among other answers and input, I would added this answer.

First of all, before we chose WiFi or Bluetooth we need to find out the difference between those two technologies.

I have made comparison chart that covers some of the important information you might need regarding your project.

enter image description here

Note: There are different versions of Bluetooth's and WiFi, this chart is to represent the the general picture of Standard Bluetooth, Bluetooth v4 and WiFi. It is always suggested to refer to manufacture specification of each technology.

From the chart we can conclude that Bluetooth has lower power consumption vs WiFi, but at the other hand WiFi has more bandwidth than Bluetooth.

Range in general is just approximation, a lot of things affecting range like human body, obstacles, location (inside or outside), if inside; structure type and materials used inside the building, noise from other sources and devices etc.

(*) Regarding scalability, I have tested WiFi and Bluetooth v4, both system with up to 8 devices, where one of those is host (group owner, server) device and 7 others are guest (clients). see the figure below.

enter image description here

What regards reliability, with Bluetooth v4 I have had some time connectivity problems, but when it works than every-thing is fine.

Note: Bluetooth v4 is not back compatible with older versions of Bluetooth, so if your host is Bluetooth v4 than all other clients should have Bluetooth v4 or vice versa.

So I will not say which one is best, but if you need longer battery life and light data communication than Bluetooth is the way. Regardless if it is Bluetooth OR WiFi you might need to start with Bluetooth to and test it, if you are happy with it than keep it, otherwise switch to WiFi.

In case you want to build your own code, the code example I followed and used previously for another university research project. It is based on 8 phones (host and client) as seen in the figure above, we collected sensor information and send it to host phone using Bluetooth 4 connection. The source code we used for that can be found here. The same project has WiFi and other type of connections.

Android official google documentation has some information and code example regarding WiFi peer to peer connection, you can follow with example of the code as well.

Regarding collecting your sensor data and sending those to one device. You could added a method that starts collecting sensor or what ever data, and after connection is established successfully than start sending it over to the other device.

As others suggest https://developers.google.com/nearby is also a way to go.


As you can rely on campus Wifi, I would definitely go with the implementation of Google Nearby APIs in my App as it was designed for such use cases...

The way it works answers your question : it makes all the heavy stuff for you, including choice between wifi or Bluetooth for better performance...


Google Nearby is definitely a good choice. You don't have to tackle all the problems when working with WiFi or Bluetooth directly. But Google Nearby only works when both devices are online and have their screens on. For a more critical review of Nearby have a look at http://blog.p2pkit.io/how-google-nearby-really-works-and-what-else-it-does

If you can not accept these limitations, you should look into other frameworks like http://www.p2pkit.io.

Disclaimer: I work for Uepaa, developing p2pkit for Android and iOS.