Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Wifi aware and Wifi P2P on Android?

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?

like image 509
Themelis Avatar asked Oct 11 '18 12:10

Themelis


People also ask

What is P2P connection in Android?

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.

What is Wi-Fi aware?

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.

What is Wi-Fi P2P service?

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.

Is Wi-Fi a P2P?

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.


3 Answers

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.

like image 170
Yong Avatar answered Oct 03 '22 05:10

Yong


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.

like image 26
bmdelacruz Avatar answered Oct 03 '22 04:10

bmdelacruz


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).

like image 34
Felipe Erias Avatar answered Oct 03 '22 04:10

Felipe Erias