Wifi-direct means to establish a connection directly through WIFI
In October 2010, the Wi-Fi Alliance released a white paper on WIFI Direct, which describes the basic information, features, and capabilities of this technology.
The WIFI Direct standard allows devices in a wireless network to connect to each other without having to go through a wireless router. This standard WiFi-enabled wireless device is connected point-to-point like Bluetooth, but in terms of transmission speed and transmission distance is much improved than Bluetooth.
WIFI Direct devices are peer-to-peer devices, which support both infrastructure networks and peer-to-peer (P2P) connections.
Android N provides WIFI Direct for direct connection to WIFI. With the WIFI Direct API, WiFi-enabled Android N phones can connect directly via WIFI without going through an access point.
WIFI Direct provides the WifiP2pManager class, whose functions are mainly divided into the following three parts:
The WifiP2pManager class provides apis for discovering connectable points, making requests, and establishing connections.
Each WifiP2pManager method requires a listener to be passed in to listen for the successful running of the method.
The WIFI Direct framework notifies users with Intent when it detects a specific event, such as a decrease in the number of connectable points or the discovery of a new connectable point.
In general, these three parts of the function are used together. Call. For example, you can through the WifiP2pManager ActionListener discoverPeers (), so that when the connection is established, The ActionListener.onSuccess() and ActionListener.onFailure() methods are used to notify you of the results.