Android Guides | Samples

Android.Net.Wifi.P2p Namespace

Provides classes to create peer-to-peer (P2P) connections with Wi-Fi Direct.


Provides classes to create peer-to-peer (P2P) connections with Wi-Fi Direct.

Using these APIs, you can discover and connect to other devices when each device supports Wi-Fi Direct, then communicate over a speedy connection across distances much longer than a Bluetooth connection. The primary class you need to work with is WifiP2pManager, which you can acquire by calling Context.GetSystemService(String). The WifiP2pManager includes APIs that allow you to:

Several other interfaces and classes are necessary as well, such as:

In order to use the Wi-Fi P2P APIs, your app must request the following user permissions:

For example code, see the Wi-Fi Direct Demo sample application.

Note: Not all Android-powered devices support Wi-Fi Direct. If your application uses Wi-Fi Direct, declare so with a <uses-feature> element in the manifest file:

xml Example

<manifest ...>
    <uses-feature android:name="" />


WifiP2pConfigA class representing a Wi-Fi P2p configuration for setting up a connection
See Also
WifiP2pDeviceA class representing a Wi-Fi p2p device Note that the operations are not thread safe
See Also
WifiP2pDeviceListA class representing a Wi-Fi P2p device list.
WifiP2pDeviceStateEnumerates values returned by several types.
WifiP2pFailureReasonEnumerates values returned by several types and taken as a parameter of the Android.Net.Wifi.P2p.WifiP2pManager.FailureEventArgs..ctor, and WifiP2pManager+IActionListener.OnFailure members.
WifiP2pGroupA class representing a Wi-Fi P2p group.
WifiP2pInfoA class representing connection information about a Wi-Fi p2p group
See Also
WifiP2pManagerThis class provides the API for managing Wi-Fi peer-to-peer connectivity.
WifiP2pManager+ChannelA channel that connects the application to the Wifi p2p framework.
WifiP2pManager+IActionListenerInterface for callback invocation on an application action
WifiP2pManager+IChannelListenerInterface for callback invocation when framework channel is lost
WifiP2pManager+IConnectionInfoListenerInterface for callback invocation when connection info is available
WifiP2pManager+IDnsSdServiceResponseListenerInterface for callback invocation when Bonjour service discovery response is received
WifiP2pManager+IDnsSdTxtRecordListenerInterface for callback invocation when Bonjour TXT record is available for a service
WifiP2pManager+IGroupInfoListenerInterface for callback invocation when group info is available
WifiP2pManager+IPeerListListenerInterface for callback invocation when peer list is available
WifiP2pManager+IUpnpServiceResponseListenerInterface for callback invocation when upnp service discovery response is received
WifiP2pStateEnumerates values returned by several types.