What is the main difference between the WiFi aware and WiFi P2P technologies?
Using WiFi P2P you can establish a connection between two or more nearby devices without the need of common network. But the android docs spec also that
Wi-Fi Aware capabilities enable devices running Android 8.0 (API level 26) and higher to discover and connect directly to each other without any other type of connectivity between them.
What is the difference between them?
Wi-Fi Direct (also known as peer-to-peer or P2P) allows your application to quickly find and interact with nearby devices, at a range beyond the capabilities of Bluetooth. The Wi-Fi Direct (P2P) APIs allow applications to connect to nearby devices without needing to connect to a network or hotspot.
The Wi-Fi Aware feature added in Android 8.0 enables supporting devices to discover, connect, and range (added in Android 9) to one another directly using the Wi-Fi Aware protocol without internet or cellular network access.
However, using Wi-Fi Direct (P2P) Service Discovery allows you to discover the services of nearby devices directly, without being connected to a network. You can also advertise the services running on your device. These capabilities help you communicate between apps, even when no local network or hotspot is available.
If Wi-Fi P2P is supported, you can obtain an instance of WifiP2pManager , create and register your broadcast receiver, and begin using the Wi-Fi P2P APIs. Note: On apps that target Android 13 (API level 33) and higher, both discoverPeers() and connect() require the android.
From https://www.wi-fi.org/knowledge-center/faq/what-is-the-relationship-between-wi-fi-aware-and-wi-fi-direct:
Wi-Fi Aware is a similar peer-to-peer connectivity technology to Wi-Fi Direct. However, while Wi-Fi Direct requires a centralized coordinator, called a Group Owner, Wi-Fi Aware creates decentralized, dynamic peer-to-peer connections. Many applications, such as Miracast and direct printer connections, work well with Wi-Fi Direct. Wi-Fi Aware is positioned to provide peer-to-peer connectivity in highly mobile environments, where devices join or leave in a less deterministic manner. Whether it's professionals at a crowded conference to find each other or strangers on a subway momentarily joining a multi-player game, Wi-Fi Aware connections seamlessly adapt to changing environment and usage conditions.
Based on the Android docs, with Wi-Fi Aware, you can send data (lightweight only! max of 255 bytes) between the devices during service discovery phase and when needed, you may open a connection between the devices to send larger data. With Wi-Fi peer-to-peer, you have to perform some kind of authentication first and then open a socket before you can send data between the devices.
Here are the portions of the Wi-Fi aware overview where I got these information:
The Wi-Fi Aware APIs let apps perform the following operations:
- Discover other devices: [...] After the subscriber discovers a publisher, the subscriber can either send a short message or establish a network connection with the discovered device.
- Create a network connection: After two devices have discovered each other [...] they can create a bi-directional Wi-Fi Aware network connection without an access point.
Note: Messages are generally used for lightweight messaging, as they might not be delivered (or be delivered out-of-order or more than once) and are limited to about 255 bytes in length.
Additionally, with Wi-Fi Aware, developers have a choice between the methods createNetworkSpecifierOpen()
and createNetworkSpecifierPassphrase()
of the DiscoverySession
class to open unencrypted or encrypted connections, respectively, between the devices.
With Wi-Fi peer to peer, developers have no other choices other than the WifiP2PManager.connect()
method. Calling it will trigger a dialog box (Push Button Configuration) on the device being connected to and that dialog box will only appear when two devices connects to each other for the first time.
By the way... modifying the WpsInfo
of a WifiP2pConfig
is useless; it will always use the Push Button Configuration option. I tested it on the devices I have (Asus ZC520TL-Nougat, Asus ZE551ML-Marshmallow, Huawei Y5-Marshmallow, and Huawei T1-KitKat). The PBC dialog appeared even if the wifip2pconfig.wps.setup
is not equal to WpsInfo.PBC
. Feel free correct me if this isn't true for all devices because it might just be an OEM thing.
For more information visit Wi-Fi peer-to-peer overview.
WiFi Aware is significantly faster at establishing a connection.
The discovery stage is much more flexible: you can add your own information (255 bytes) to your service announcements and exchange short messages (255 bytes) with other peers without needing to establish a connection.
However, all the connections in WiFi Aware are one-to-one. A device can only have a very limited number of simultaneous connections (two, in the case of the Pixel 2).
For comparison, WiFi P2P works more similarly to an automatic Hotspot: the devices negotiate among themselves which of them will create a WiFi network, and afterwards other devices can join in. If you manage to get the WiFi SSID/password, it is possible to join the network manually.
My understanding is that WiFi P2P has worse performance in terms of battery (at least in the case of the central node).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With