Google’s new Wi-Fi Aware functionality, also known as Neighbor Awareness Networking (NAN), allows devices running on Android 8.0 (API level 26) and higher to detect and directly connect to each other without any secondary connectivity, such as Bluetooth.
Wi-Fi Aware connects devices by grouping together existing devices in a given location or by establishing a new group for devices that are first to enter a location. The Wi-Fi Aware system service manages this function, while apps themselves have no control over grouping behavior. Instead, applications use the Wi-Fi Aware APIs to communicate with the Wi-Fi Aware system service, which manages the device’s Wi-Fi Aware hardware.
The Wi-Fi Aware APIs enable apps to discover other devices as well as establish the necessary network connection to those devices. The discovery process begins when a single device publishes at least one discoverable service. At that point, once another device subscribes to the first device and enters the publisher’s Wi-Fi range, the subscriber receives an update that a matching publisher has been discovered. Once a subscriber identifies a publisher, the subscriber can either send a brief message or initiate a network connection with the discovered device. For coverage purposes, devices can be both publishers and subscribers.
Then, as soon as two devices recognize one another, they can generate a bi-directional Wi-Fi Aware network connection without an access point. Wi-Fi Aware network connections offer the advantage of better connection across longer distances than those of Bluetooth. Therefore, this connection is ideal for applications that share large amounts of data among users, such as photo-sharing apps.
In order to access Wi-Fi Aware discovery and networking, users can request the following permissions in their apps’ manifest: Access WiFi State, Change WiFi State, Access Fine Location, Change Network State, Internet. Next, they can confirm whether their device supports Wi-Fi Aware with the PackManager API. Thirdly, users may check if Wi-Fi Aware is currently available. After all, while Wi-Fi Aware might exist on a device, the device cannot access the functionality if Location or Wi-Fi is disabled.
That said, some devices may not support Wi-Fi Aware depending on their firmware and hardware settings, if Wi-Fi Direct, SoftAP or tethering is active. To that end, users should be aware that Wi-Fi Aware availability can change at any time. An application should register BroadcastReceiver to receive Action Wi-Fi Aware State Changed and notify of any availability changes. Once an app receives this notification, all existing sessions should be discarded.
WifiNanScan App: play.google.com/store/apps/det … tion.rtt.wifinanscan