Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#nestedclasses) \| [Constants](https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#constants) \| [Methods](https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#inhmethods)

# WifiP2pManager

*** ** * ** ***


`
public


class
WifiP2pManager
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.net.wifi.p2p.WifiP2pManager |

<br />

*** ** * ** ***

This class provides the API for managing Wi-Fi peer-to-peer connectivity. This lets an
application discover available peers, setup connection to peers and query for the list of peers.
When a p2p connection is formed over wifi, the device continues to maintain the uplink
connection over mobile or any other available network for internet connectivity on the device.

The API is asynchronous and responses to requests from an application are on listener
callbacks provided by the application. The application needs to do an initialization with
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` before doing any p2p operation.

Most application calls need a `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener` instance for receiving callbacks
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`. Action callbacks
indicate whether the initiation of the action was a success or a failure.
Upon failure, the reason of failure can be one of `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#ERROR`, `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#P2P_UNSUPPORTED`
or `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#BUSY`.

An application can initiate discovery of peers with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#discoverPeers(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`. An initiated
discovery request from an application stays active until the device starts connecting to a peer
,forms a p2p group or there is an explicit `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#stopPeerDiscovery(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`.
Applications can listen to `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_DISCOVERY_CHANGED_ACTION` to know if a peer-to-peer
discovery is running or stopped. Additionally, `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_PEERS_CHANGED_ACTION` indicates
if the peer list has changed.

When an application needs to fetch the current list of peers, it can request the list
of peers with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestPeers(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.PeerListListener)`. When the peer list is available
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.PeerListListener#onPeersAvailable(android.net.wifi.p2p.WifiP2pDeviceList)` is called with the device list.

An application can initiate a connection request to a peer through `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#connect(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pConfig,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`. See
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig` for details on setting up the configuration. For communication with legacy
Wi-Fi devices that do not support p2p, an app can create a group using `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#createGroup(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pConfig,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`
which creates an access point whose details can be fetched with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestGroupInfo(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.GroupInfoListener)`.

After a successful group formation through `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#createGroup(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pConfig,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` or through `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#connect(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pConfig,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`,
use `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestConnectionInfo(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ConnectionInfoListener)` to fetch the connection details. The connection info
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pInfo` contains the address of the group owner
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pInfo#groupOwnerAddress` and a flag `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pInfo#isGroupOwner` to indicate
if the current device is a p2p group owner. A p2p client can thus communicate with
the p2p group owner through a socket connection. If the current device is the p2p group owner,
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pInfo#groupOwnerAddress` is anonymized unless the caller holds the
`android.Manifest.permission#LOCAL_MAC_ADDRESS` permission.

With peer discovery using `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#discoverPeers(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`, an application discovers the neighboring
peers, but has no good way to figure out which peer to establish a connection with. For example,
if a game application is interested in finding all the neighboring peers that are also running
the same game, it has no way to find out until after the connection is setup. Pre-association
service discovery is meant to address this issue of filtering the peers based on the running
services.

With pre-association service discovery, an application can advertise a service for a
application on a peer device prior to a connection setup between the devices.
Currently, DNS based service discovery (Bonjour) and Upnp are the higher layer protocols
supported. Get Bonjour resources at dns-sd.org and Upnp resources at upnp.org
As an example, a video application can discover a Upnp capable media renderer
prior to setting up a Wi-fi p2p connection with the device.

An application can advertise a Upnp or a Bonjour service with a call to
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#addLocalService(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceInfo,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`. After a local service is added,
the framework automatically responds to a peer application discovering the service prior
to establishing a p2p connection. A call to `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#removeLocalService(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceInfo,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` removes a local
service and `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#clearLocalServices(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` can be used to clear all local services.

An application that is looking for peer devices that support certain services
can do so with a call to `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#discoverServices(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`. Prior to initiating the discovery,
application can add service discovery request with a call to `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#addServiceRequest(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceRequest,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`,
remove a service discovery request with a call to `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#removeServiceRequest(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceRequest,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` or clear
all requests with a call to `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#clearServiceRequests(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`. When no service requests remain,
a previously running service discovery will stop.

The application is notified of a result of service discovery request through listener callbacks
set through `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setDnsSdResponseListeners(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.DnsSdServiceResponseListener,%20android.net.wifi.p2p.WifiP2pManager.DnsSdTxtRecordListener)` for Bonjour or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setUpnpServiceResponseListener(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.UpnpServiceResponseListener)` for Upnp.

**Note:**
Registering an application handler with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` requires the permissions
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_WIFI_STATE` and
`https://developer.android.com/reference/android/Manifest.permission#CHANGE_WIFI_STATE` to perform any further peer-to-peer
operations.


Restricted for SDK Runtime environment in API level 34.
**See also:**

- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig`
- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pInfo`
- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pGroup`
- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDevice`
- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDeviceList`
- `https://developer.android.com/reference/android/net/wifi/WpsInfo`

## Summary

| ### Nested classes ||
|---|---|
| ` interface` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener` Interface for callback invocation on an application action |
| ` class` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel` A channel that connects the application to the Wifi p2p framework. |
| ` interface` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ChannelListener` Interface for callback invocation when framework channel is lost |
| ` interface` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ConnectionInfoListener` Interface for callback invocation when connection info is available |
| ` interface` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.DeviceInfoListener` Interface for callback invocation when `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDevice` is available in response to `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestDeviceInfo(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.DeviceInfoListener)`. |
| ` interface` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.DiscoveryStateListener` Interface for callback invocation when p2p state is available in response to `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestDiscoveryState(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.DiscoveryStateListener)`. |
| ` interface` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.DnsSdServiceResponseListener` Interface for callback invocation when Bonjour service discovery response is received |
| ` interface` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.DnsSdTxtRecordListener` Interface for callback invocation when Bonjour TXT record is available for a service |
| ` interface` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ExternalApproverRequestListener` Interface for callback invocation when an incoming request is received. |
| ` interface` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.GroupInfoListener` Interface for callback invocation when group info is available |
| ` interface` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.NetworkInfoListener` Interface for callback invocation when `https://developer.android.com/reference/android/net/NetworkInfo` is available in response to `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestNetworkInfo(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.NetworkInfoListener)`. |
| ` interface` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.P2pStateListener` Interface for callback invocation when p2p state is available in response to `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestP2pState(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.P2pStateListener)`. |
| ` interface` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.PeerListListener` Interface for callback invocation when peer list is available |
| ` interface` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ServiceResponseListener` Interface for callback invocation when service discovery response other than Upnp or Bonjour is received |
| ` interface` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.UpnpServiceResponseListener` Interface for callback invocation when upnp service discovery response is received |
| ` interface` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.WifiP2pListener` Interface used to listen to Wi-Fi p2p various changes such as device state change, discovery started/stopped, connection change, etc. |

| ### Constants ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#ACTION_WIFI_P2P_LISTEN_STATE_CHANGED` Broadcast intent action indicating that peer listen has either started or stopped. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#ACTION_WIFI_P2P_REQUEST_RESPONSE_CHANGED` Broadcast intent action indicating whether or not current connecting request is accepted. |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#BUSY` Passed with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`. |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#CONNECTION_REQUEST_ACCEPT` Accept the incoming request. |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#CONNECTION_REQUEST_DEFER_SHOW_PASSWORD_TO_SERVICE` Defer the Wi-Fi Direct R2 pairing bootstrapping password display to the Wi-Fi service (which will display a dialog to the user). |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#CONNECTION_REQUEST_DEFER_SHOW_PIN_TO_SERVICE` Defer the WPS PIN or Wi-Fi Direct R2 pairing bootstrapping PIN display to the Wi-Fi service (which will display a dialog to the user). |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#CONNECTION_REQUEST_DEFER_TO_SERVICE` Defer the decision back to the Wi-Fi service (which will display a dialog to the user). |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#CONNECTION_REQUEST_REJECT` Reject the incoming request. |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#ERROR` Passed with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_DISCOVERY_STATE` The lookup key for an int that indicates whether p2p discovery has started or stopped. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_LISTEN_STATE` The lookup key for an int that indicates whether p2p listen has started or stopped. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_NETWORK_INFO` The lookup key for a `https://developer.android.com/reference/android/net/NetworkInfo` object associated with the p2p network. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_P2P_DEVICE_LIST` The lookup key for a `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDeviceList` object representing the new peer list when `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_PEERS_CHANGED_ACTION` broadcast is sent. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_REQUEST_CONFIG` The lookup key for the `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig` object of a request. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_REQUEST_RESPONSE` The lookup key for the result of a request, true if accepted, false otherwise. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_WIFI_P2P_DEVICE` The lookup key for a `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDevice` object Retrieve with `https://developer.android.com/reference/android/content/Intent#getParcelableExtra(java.lang.String)`. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_WIFI_P2P_GROUP` The lookup key for a `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pGroup` object associated with the p2p network. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_WIFI_P2P_INFO` The lookup key for a `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pInfo` object Retrieve with `https://developer.android.com/reference/android/content/Intent#getParcelableExtra(java.lang.String)`. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_WIFI_STATE` The lookup key for an int that indicates whether Wi-Fi p2p is enabled or disabled. |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#GROUP_CREATION_FAILURE_REASON_CONNECTION_CANCELLED` P2p group creation failed because the connection has been cancelled. |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#GROUP_CREATION_FAILURE_REASON_GROUP_REMOVED` P2p group creation failed because the group has been removed. |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#GROUP_CREATION_FAILURE_REASON_INVITATION_FAILED` P2p group creation failed because invitation has failed. |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#GROUP_CREATION_FAILURE_REASON_PROVISION_DISCOVERY_FAILED` P2p group creation failed because provision discovery has failed. |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#GROUP_CREATION_FAILURE_REASON_TIMED_OUT` P2p group creation failed because it has timed out. |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#GROUP_CREATION_FAILURE_REASON_USER_REJECTED` P2p group creation failed because user has rejected. |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#NO_PERMISSION` Passed with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`. |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#NO_SERVICE_REQUESTS` Passed with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`. |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#P2P_UNSUPPORTED` Passed with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_CONNECTION_CHANGED_ACTION` Broadcast intent action indicating that the state of Wi-Fi p2p connectivity has changed. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_DISCOVERY_CHANGED_ACTION` Broadcast intent action indicating that peer discovery has either started or stopped. |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_DISCOVERY_STARTED` p2p discovery has started |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_DISCOVERY_STOPPED` p2p discovery has stopped |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_LISTEN_STARTED` p2p listen has started |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_LISTEN_STOPPED` p2p listen has stopped |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_PEERS_CHANGED_ACTION` Broadcast intent action indicating that the available peer list has changed. |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_SCAN_FULL` Run P2P scan on all channels. |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_SCAN_SINGLE_FREQ` Run P2P scan only on a specific channel. |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_SCAN_SOCIAL` Run P2P scan only on social channels. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_STATE_CHANGED_ACTION` Broadcast intent action to indicate whether Wi-Fi p2p is enabled or disabled. |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_STATE_DISABLED` Wi-Fi p2p is disabled. |
| `int` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_STATE_ENABLED` Wi-Fi p2p is enabled. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_THIS_DEVICE_CHANGED_ACTION` Broadcast intent action indicating that this device details have changed. |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#addExternalApprover(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.MacAddress,%20android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel c, https://developer.android.com/reference/android/net/MacAddress deviceAddress, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ExternalApproverRequestListener listener) ` Set the external approver for a specific peer. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#addLocalService(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceInfo,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/nsd/WifiP2pServiceInfo servInfo, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Register a local service for service discovery. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#addServiceRequest(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceRequest,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/nsd/WifiP2pServiceRequest req, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Add a service discovery request. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#cancelConnect(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Cancel any ongoing p2p group negotiation The function call immediately returns after sending a connection cancellation request to the framework. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#clearLocalServices(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Clear all registered local services of service discovery. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#clearServiceRequests(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Clear all registered service discovery requests. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#connect(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pConfig,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig config, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Start a p2p connection to a device with the specified configuration. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#createGroup(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Create a p2p group with the current device as the group owner. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#createGroup(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pConfig,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig config, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Create a p2p group with the current device as the group owner. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#discoverPeers(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Initiate peer discovery. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#discoverPeersOnSocialChannels(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Scan only the social channels. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#discoverPeersOnSpecificFrequency(android.net.wifi.p2p.WifiP2pManager.Channel,%20int,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, int frequencyMhz, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Scan only a single channel specified by frequency. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#discoverServices(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Initiate service discovery. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#discoverUsdBasedServices(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pUsdBasedServiceDiscoveryConfig,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pUsdBasedServiceDiscoveryConfig config, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Initiate Un-synchronized service discovery (USD) based service discovery. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#getListenState(android.net.wifi.p2p.WifiP2pManager.Channel,%20java.util.concurrent.Executor,%20java.util.function.Consumer<java.lang.Integer>)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel c, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/java/util/function/Consumer<https://developer.android.com/reference/java/lang/Integer> resultsCallback) ` Get p2p listen state. |
| ` static int` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#getP2pMaxAllowedVendorElementsLengthBytes()() ` Return the maximum total length (in bytes) of all Vendor specific information elements (VSIEs) which can be set using the `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setVendorElements(android.net.wifi.p2p.WifiP2pManager.Channel,%20java.util.List<android.net.wifi.ScanResult.InformationElement>,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`. |
| ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)(https://developer.android.com/reference/android/content/Context srcContext, https://developer.android.com/reference/android/os/Looper srcLooper, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ChannelListener listener) ` Registers the application with the Wi-Fi framework. |
| ` boolean` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isChannelConstrainedDiscoverySupported()() ` Check if this device supports discovery limited to a specific frequency or the social channels. |
| ` boolean` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isGroupClientRemovalSupported()() ` Check if this device supports removing clients from a group. |
| ` boolean` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isGroupOwnerIPv6LinkLocalAddressProvided()() ` Checks whether this device, while being a group client, can discover and deliver the group owner's IPv6 link-local address. |
| ` boolean` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isPccModeSupported()() ` Check if this device supports P2P Connection Compatibility Mode(R1/R2 compatibility mode). |
| ` boolean` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isSetVendorElementsSupported()() ` Check if this device supports setting vendor elements. |
| ` boolean` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isWiFiDirectR2Supported()() ` Check if this device supports Wi-Fi Direct R2 (P2P2). |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#registerWifiP2pListener(java.util.concurrent.Executor,%20android.net.wifi.p2p.WifiP2pManager.WifiP2pListener)(https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.WifiP2pListener listener) ` Add a listener to listen to Wi-Fi p2p various changes. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#removeClient(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.MacAddress,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/MacAddress peerAddress, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Remove the client with the MAC address from the group. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#removeExternalApprover(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.MacAddress,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel c, https://developer.android.com/reference/android/net/MacAddress deviceAddress, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Remove the external approver for a specific peer. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#removeGroup(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Remove the current p2p group. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#removeLocalService(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceInfo,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/nsd/WifiP2pServiceInfo servInfo, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Remove a registered local service added with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#addLocalService(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceInfo,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` The function call immediately returns after sending a request to remove a local service to the framework. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#removeServiceRequest(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceRequest,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/nsd/WifiP2pServiceRequest req, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Remove a specified service discovery request added with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#addServiceRequest(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceRequest,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` The function call immediately returns after sending a request to remove service discovery request to the framework. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestConnectionInfo(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ConnectionInfoListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ConnectionInfoListener listener) ` Request device connection info. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestDeviceInfo(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.DeviceInfoListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel c, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.DeviceInfoListener listener) ` Request Device Info This method provides the device info in the form of a `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDevice`. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestDirInfo(android.net.wifi.p2p.WifiP2pManager.Channel,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.net.wifi.p2p.WifiP2pDirInfo,java.lang.Exception>)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel c, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/os/OutcomeReceiver<https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDirInfo, https://developer.android.com/reference/java/lang/Exception> callback) ` Get the Device Identity Resolution (DIR) Information. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestDiscoveryState(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.DiscoveryStateListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel c, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.DiscoveryStateListener listener) ` Request p2p discovery state. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestGroupInfo(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.GroupInfoListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.GroupInfoListener listener) ` Request p2p group info. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestNetworkInfo(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.NetworkInfoListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel c, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.NetworkInfoListener listener) ` Request network info. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestP2pState(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.P2pStateListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel c, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.P2pStateListener listener) ` Request p2p enabled state. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestPeers(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.PeerListListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.PeerListListener listener) ` Request the current list of peers. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setConnectionRequestResult(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.MacAddress,%20int,%20java.lang.String,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel c, https://developer.android.com/reference/android/net/MacAddress deviceAddress, int result, https://developer.android.com/reference/java/lang/String pinOrPassword, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Set the result with PIN for the incoming request from a specific peer. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setConnectionRequestResult(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.MacAddress,%20int,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel c, https://developer.android.com/reference/android/net/MacAddress deviceAddress, int result, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Set the result for the incoming request from a specific peer. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setDnsSdResponseListeners(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.DnsSdServiceResponseListener,%20android.net.wifi.p2p.WifiP2pManager.DnsSdTxtRecordListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.DnsSdServiceResponseListener servListener, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.DnsSdTxtRecordListener txtListener) ` Register a callback to be invoked on receiving Bonjour service discovery response. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setServiceResponseListener(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ServiceResponseListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ServiceResponseListener listener) ` Register a callback to be invoked on receiving service discovery response. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setUpnpServiceResponseListener(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.UpnpServiceResponseListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.UpnpServiceResponseListener listener) ` Register a callback to be invoked on receiving upnp service discovery response. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setVendorElements(android.net.wifi.p2p.WifiP2pManager.Channel,%20java.util.List<android.net.wifi.ScanResult.InformationElement>,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel c, https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/net/wifi/ScanResult.InformationElement> vendorElements, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Set/Clear vendor specific information elements (VSIEs) to be published during Wi-Fi Direct (P2P) discovery. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setWfdInfo(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pWfdInfo,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pWfdInfo wfdInfo, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Set Wifi Display information. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#startListening(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Force p2p to enter listen state. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#startPeerDiscovery(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pDiscoveryConfig,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDiscoveryConfig config, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Initiate peer discovery. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#startUsdBasedLocalServiceAdvertisement(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceInfo,%20android.net.wifi.p2p.WifiP2pUsdBasedLocalServiceAdvertisementConfig,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/nsd/WifiP2pServiceInfo servInfo, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pUsdBasedLocalServiceAdvertisementConfig config, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Start a service discovery advertisement using Un-synchronized service discovery (USD). |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#stopListening(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Force p2p to exit listen state. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#stopPeerDiscovery(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel channel, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener listener) ` Stop an ongoing peer discovery The function call immediately returns after sending a stop request to the framework. |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#unregisterWifiP2pListener(android.net.wifi.p2p.WifiP2pManager.WifiP2pListener)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.WifiP2pListener listener) ` Remove a listener added using `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#registerWifiP2pListener(java.util.concurrent.Executor,%20android.net.wifi.p2p.WifiP2pManager.WifiP2pListener)` |
| ` void` | ` https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#validateDirInfo(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pDirInfo,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<java.lang.Boolean,java.lang.Exception>)(https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel c, https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDirInfo dirInfo, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/os/OutcomeReceiver<https://developer.android.com/reference/java/lang/Boolean, https://developer.android.com/reference/java/lang/Exception> callback) ` Validate the Device Identity Resolution (DIR) Information of a P2P device. |

### Inherited methods

From class `

https://developer.android.com/reference/java/lang/Object

` `


https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/java/lang/Object#clone()()
`

Creates and returns a copy of this object.


`


boolean` `
https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj)
`

Indicates whether some other object is "equal to" this one.


`


void` `
https://developer.android.com/reference/java/lang/Object#finalize()()
`

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.


`


final

https://developer.android.com/reference/java/lang/Class<?>` `
https://developer.android.com/reference/java/lang/Object#getClass()()
`

Returns the runtime class of this `Object`.


`


int` `
https://developer.android.com/reference/java/lang/Object#hashCode()()
`

Returns a hash code value for the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notify()()
`

Wakes up a single thread that is waiting on this object's
monitor.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notifyAll()()
`

Wakes up all threads that are waiting on this object's monitor.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Object#toString()()
`

Returns a string representation of the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait()()
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*.


## Constants

### ACTION_WIFI_P2P_LISTEN_STATE_CHANGED

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String ACTION_WIFI_P2P_LISTEN_STATE_CHANGED
```

Broadcast intent action indicating that peer listen has either started or stopped.
One extra `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_LISTEN_STATE` indicates whether listen has started or stopped.

<br />

Constant Value:

"android.net.wifi.p2p.action.WIFI_P2P_LISTEN_STATE_CHANGED"


### ACTION_WIFI_P2P_REQUEST_RESPONSE_CHANGED

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String ACTION_WIFI_P2P_REQUEST_RESPONSE_CHANGED
```

Broadcast intent action indicating whether or not current connecting
request is accepted.

The connecting request is initiated by
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#connect(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pConfig,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`.

The `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_REQUEST_RESPONSE` extra indicates whether or not current
request is accepted or rejected.

The `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_REQUEST_CONFIG` extra indicates the responsed configuration.

<br />

Constant Value:

"android.net.wifi.p2p.action.WIFI_P2P_REQUEST_RESPONSE_CHANGED"


### BUSY

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BUSY
```

Passed with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.
Indicates that the operation failed because the framework is busy and
unable to service the request

<br />

Constant Value:

2
(0x00000002)


### CONNECTION_REQUEST_ACCEPT

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int CONNECTION_REQUEST_ACCEPT
```

Accept the incoming request.

Used in `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setConnectionRequestResult(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.MacAddress,%20int,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`.

<br />

Constant Value:

0
(0x00000000)


### CONNECTION_REQUEST_DEFER_SHOW_PASSWORD_TO_SERVICE

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final int CONNECTION_REQUEST_DEFER_SHOW_PASSWORD_TO_SERVICE
```

Defer the Wi-Fi Direct R2 pairing bootstrapping password display to the Wi-Fi service
(which will display a dialog to the user).

Used in `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setConnectionRequestResult(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.MacAddress,%20int,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`.

<br />

Constant Value:

4
(0x00000004)


### CONNECTION_REQUEST_DEFER_SHOW_PIN_TO_SERVICE

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int CONNECTION_REQUEST_DEFER_SHOW_PIN_TO_SERVICE
```

Defer the WPS PIN or Wi-Fi Direct R2 pairing bootstrapping PIN display to the Wi-Fi service
(which will display a dialog to the user).

Used in `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setConnectionRequestResult(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.MacAddress,%20int,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`.

<br />

Constant Value:

3
(0x00000003)


### CONNECTION_REQUEST_DEFER_TO_SERVICE

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int CONNECTION_REQUEST_DEFER_TO_SERVICE
```

Defer the decision back to the Wi-Fi service (which will display a dialog to the user).

Used in `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setConnectionRequestResult(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.MacAddress,%20int,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`.

<br />

Constant Value:

2
(0x00000002)


### CONNECTION_REQUEST_REJECT

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int CONNECTION_REQUEST_REJECT
```

Reject the incoming request.

Used in `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setConnectionRequestResult(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.MacAddress,%20int,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`.

<br />

Constant Value:

1
(0x00000001)


### ERROR

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ERROR
```

Passed with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.
Indicates that the operation failed due to an internal error.

<br />

Constant Value:

0
(0x00000000)


### EXTRA_DISCOVERY_STATE

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_DISCOVERY_STATE
```

The lookup key for an int that indicates whether p2p discovery has started or stopped.
Retrieve it with `https://developer.android.com/reference/android/content/Intent#getIntExtra(java.lang.String,%20int)`.

<br />

**See also:**

- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_DISCOVERY_STARTED`
- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_DISCOVERY_STOPPED`

Constant Value:

"discoveryState"


### EXTRA_LISTEN_STATE

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_LISTEN_STATE
```

The lookup key for an int that indicates whether p2p listen has started or stopped.
Retrieve it with `https://developer.android.com/reference/android/content/Intent#getIntExtra(java.lang.String,%20int)`.

<br />

**See also:**

- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_LISTEN_STARTED`
- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_LISTEN_STOPPED`

Constant Value:

"android.net.wifi.p2p.extra.LISTEN_STATE"


### EXTRA_NETWORK_INFO

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_NETWORK_INFO
```

The lookup key for a `https://developer.android.com/reference/android/net/NetworkInfo` object associated with the
p2p network. Retrieve with
`https://developer.android.com/reference/android/content/Intent#getParcelableExtra(java.lang.String)`.

<br />

Constant Value:

"networkInfo"


### EXTRA_P2P_DEVICE_LIST

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_P2P_DEVICE_LIST
```

The lookup key for a `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDeviceList` object representing
the new peer list when `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_PEERS_CHANGED_ACTION` broadcast is sent.

Retrieve with `https://developer.android.com/reference/android/content/Intent#getParcelableExtra(java.lang.String)`.

<br />

Constant Value:

"wifiP2pDeviceList"


### EXTRA_REQUEST_CONFIG

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_REQUEST_CONFIG
```

The lookup key for the `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig` object of a request.

<br />

Constant Value:

"android.net.wifi.p2p.extra.REQUEST_CONFIG"


### EXTRA_REQUEST_RESPONSE

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_REQUEST_RESPONSE
```

The lookup key for the result of a request, true if accepted, false otherwise.

<br />

Constant Value:

"android.net.wifi.p2p.extra.REQUEST_RESPONSE"


### EXTRA_WIFI_P2P_DEVICE

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_WIFI_P2P_DEVICE
```

The lookup key for a `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDevice` object
Retrieve with `https://developer.android.com/reference/android/content/Intent#getParcelableExtra(java.lang.String)`.

<br />

Constant Value:

"wifiP2pDevice"


### EXTRA_WIFI_P2P_GROUP

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_WIFI_P2P_GROUP
```

The lookup key for a `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pGroup` object
associated with the p2p network. Retrieve with
`https://developer.android.com/reference/android/content/Intent#getParcelableExtra(java.lang.String)`.

<br />

Constant Value:

"p2pGroupInfo"


### EXTRA_WIFI_P2P_INFO

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_WIFI_P2P_INFO
```

The lookup key for a `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pInfo` object
Retrieve with `https://developer.android.com/reference/android/content/Intent#getParcelableExtra(java.lang.String)`.

<br />

Constant Value:

"wifiP2pInfo"


### EXTRA_WIFI_STATE

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_WIFI_STATE
```

The lookup key for an int that indicates whether Wi-Fi p2p is enabled or disabled.
Retrieve it with `https://developer.android.com/reference/android/content/Intent#getIntExtra(java.lang.String,%20int)`.

<br />

**See also:**

- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_STATE_DISABLED`
- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_STATE_ENABLED`

Constant Value:

"wifi_p2p_state"


### GROUP_CREATION_FAILURE_REASON_CONNECTION_CANCELLED

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GROUP_CREATION_FAILURE_REASON_CONNECTION_CANCELLED
```

P2p group creation failed because the connection has been cancelled.
Used in `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.WifiP2pListener#onGroupCreationFailed(int)`.

<br />

Constant Value:

0
(0x00000000)


### GROUP_CREATION_FAILURE_REASON_GROUP_REMOVED

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GROUP_CREATION_FAILURE_REASON_GROUP_REMOVED
```

P2p group creation failed because the group has been removed.
Used in `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.WifiP2pListener#onGroupCreationFailed(int)`.

<br />

Constant Value:

4
(0x00000004)


### GROUP_CREATION_FAILURE_REASON_INVITATION_FAILED

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GROUP_CREATION_FAILURE_REASON_INVITATION_FAILED
```

P2p group creation failed because invitation has failed.
Used in `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.WifiP2pListener#onGroupCreationFailed(int)`.

<br />

Constant Value:

5
(0x00000005)


### GROUP_CREATION_FAILURE_REASON_PROVISION_DISCOVERY_FAILED

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GROUP_CREATION_FAILURE_REASON_PROVISION_DISCOVERY_FAILED
```

P2p group creation failed because provision discovery has failed.
Used in `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.WifiP2pListener#onGroupCreationFailed(int)`.

<br />

Constant Value:

3
(0x00000003)


### GROUP_CREATION_FAILURE_REASON_TIMED_OUT

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GROUP_CREATION_FAILURE_REASON_TIMED_OUT
```

P2p group creation failed because it has timed out.
Used in `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.WifiP2pListener#onGroupCreationFailed(int)`.

<br />

Constant Value:

1
(0x00000001)


### GROUP_CREATION_FAILURE_REASON_USER_REJECTED

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GROUP_CREATION_FAILURE_REASON_USER_REJECTED
```

P2p group creation failed because user has rejected.
Used in `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.WifiP2pListener#onGroupCreationFailed(int)`.

<br />

Constant Value:

2
(0x00000002)


### NO_PERMISSION

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int NO_PERMISSION
```

Passed with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.
Indicates that the operation failed due to calling app doesn't have permission to call the
API.

<br />

Constant Value:

4
(0x00000004)


### NO_SERVICE_REQUESTS

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int NO_SERVICE_REQUESTS
```

Passed with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.
Indicates that the `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#discoverServices(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` failed because no service
requests are added. Use `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#addServiceRequest(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceRequest,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` to add a service
request.

<br />

Constant Value:

3
(0x00000003)


### P2P_UNSUPPORTED

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int P2P_UNSUPPORTED
```

Passed with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.
Indicates that the operation failed because p2p is unsupported on the device.

<br />

Constant Value:

1
(0x00000001)


### WIFI_P2P_CONNECTION_CHANGED_ACTION

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String WIFI_P2P_CONNECTION_CHANGED_ACTION
```

Broadcast intent action indicating that the state of Wi-Fi p2p connectivity
has changed. One extra `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_WIFI_P2P_INFO` provides the p2p connection info in
the form of a `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pInfo` object. Another extra `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_NETWORK_INFO` provides
the network info in the form of a `https://developer.android.com/reference/android/net/NetworkInfo`. A third extra provides
the details of the group and may contain a `null`.

All of these permissions are required to receive this broadcast:
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_WIFI_STATE` and either
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` or
`https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES`

<br />

**See also:**

- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_WIFI_P2P_INFO`
- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_NETWORK_INFO`
- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_WIFI_P2P_GROUP`

Constant Value:

"android.net.wifi.p2p.CONNECTION_STATE_CHANGE"


### WIFI_P2P_DISCOVERY_CHANGED_ACTION

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String WIFI_P2P_DISCOVERY_CHANGED_ACTION
```

Broadcast intent action indicating that peer discovery has either started or stopped.
One extra `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_DISCOVERY_STATE` indicates whether discovery has started
or stopped.

Note that discovery will be stopped during a connection setup. If the application tries
to re-initiate discovery during this time, it can fail.

<br />

Constant Value:

"android.net.wifi.p2p.DISCOVERY_STATE_CHANGE"


### WIFI_P2P_DISCOVERY_STARTED

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int WIFI_P2P_DISCOVERY_STARTED
```

p2p discovery has started

<br />

**See also:**

- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_DISCOVERY_CHANGED_ACTION`

Constant Value:

2
(0x00000002)


### WIFI_P2P_DISCOVERY_STOPPED

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int WIFI_P2P_DISCOVERY_STOPPED
```

p2p discovery has stopped

<br />

**See also:**

- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_DISCOVERY_CHANGED_ACTION`

Constant Value:

1
(0x00000001)


### WIFI_P2P_LISTEN_STARTED

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int WIFI_P2P_LISTEN_STARTED
```

p2p listen has started

<br />

**See also:**

- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#ACTION_WIFI_P2P_LISTEN_STATE_CHANGED`

Constant Value:

2
(0x00000002)


### WIFI_P2P_LISTEN_STOPPED

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int WIFI_P2P_LISTEN_STOPPED
```

p2p listen has stopped

<br />

**See also:**

- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#ACTION_WIFI_P2P_LISTEN_STATE_CHANGED`

Constant Value:

1
(0x00000001)


### WIFI_P2P_PEERS_CHANGED_ACTION

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String WIFI_P2P_PEERS_CHANGED_ACTION
```

Broadcast intent action indicating that the available peer list has changed. This
can be sent as a result of peers being found, lost or updated.

All of these permissions are required to receive this broadcast:
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_WIFI_STATE` and either
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` or
`https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES`

An extra `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_P2P_DEVICE_LIST` provides the full list of
current peers. The full list of peers can also be obtained any time with
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestPeers(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.PeerListListener)`.

<br />

**See also:**

- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_P2P_DEVICE_LIST`

Constant Value:

"android.net.wifi.p2p.PEERS_CHANGED"


### WIFI_P2P_SCAN_FULL

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int WIFI_P2P_SCAN_FULL
```

Run P2P scan on all channels.

<br />

Constant Value:

0
(0x00000000)


### WIFI_P2P_SCAN_SINGLE_FREQ

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int WIFI_P2P_SCAN_SINGLE_FREQ
```

Run P2P scan only on a specific channel.

<br />

Constant Value:

2
(0x00000002)


### WIFI_P2P_SCAN_SOCIAL

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int WIFI_P2P_SCAN_SOCIAL
```

Run P2P scan only on social channels.

<br />

Constant Value:

1
(0x00000001)


### WIFI_P2P_STATE_CHANGED_ACTION

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String WIFI_P2P_STATE_CHANGED_ACTION
```

Broadcast intent action to indicate whether Wi-Fi p2p is enabled or disabled. An
extra `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_WIFI_STATE` provides the state information as int.

<br />

**See also:**

- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_WIFI_STATE`

Constant Value:

"android.net.wifi.p2p.STATE_CHANGED"


### WIFI_P2P_STATE_DISABLED

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int WIFI_P2P_STATE_DISABLED
```

Wi-Fi p2p is disabled.

<br />

**See also:**

- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_STATE_CHANGED_ACTION`

Constant Value:

1
(0x00000001)


### WIFI_P2P_STATE_ENABLED

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int WIFI_P2P_STATE_ENABLED
```

Wi-Fi p2p is enabled.

<br />

**See also:**

- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_STATE_CHANGED_ACTION`

Constant Value:

2
(0x00000002)


### WIFI_P2P_THIS_DEVICE_CHANGED_ACTION

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String WIFI_P2P_THIS_DEVICE_CHANGED_ACTION
```

Broadcast intent action indicating that this device details have changed.

An extra `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_WIFI_P2P_DEVICE` provides this device details.
The valid device details can also be obtained with
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestDeviceInfo(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.DeviceInfoListener)` when p2p is enabled.
To get information notifications on P2P getting enabled refers
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_STATE_ENABLED`.

The `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_WIFI_P2P_DEVICE` extra contains an anonymized version of the device's
MAC address. Callers holding the `android.Manifest.permission#LOCAL_MAC_ADDRESS`
permission can use `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestDeviceInfo(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.DeviceInfoListener)` to obtain the actual MAC address of this
device.

All of these permissions are required to receive this broadcast:
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_WIFI_STATE` and either
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` or
`https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES`

<br />

**See also:**

- `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_WIFI_P2P_DEVICE`

Constant Value:

"android.net.wifi.p2p.THIS_DEVICE_CHANGED"


## Public methods

### addExternalApprover

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void addExternalApprover (WifiP2pManager.Channel c, 
                MacAddress deviceAddress, 
                WifiP2pManager.ExternalApproverRequestListener listener)
```

Set the external approver for a specific peer.

This API associates a specific peer with an approver. When an incoming request is received
from a peer, an authorization request is routed to the attached approver. The approver then
calls `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setConnectionRequestResult(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.MacAddress,%20int,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` to send
the result to the WiFi service. A specific peer (identified by its `MacAddress`) can
only be attached to a single approver. The previous approver will be detached once a new
approver is attached. The approver will also be detached automatically when the channel is
closed.


When an approver is attached, `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ExternalApproverRequestListener#onAttached(android.net.MacAddress)`
is called. When an approver is detached,
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ExternalApproverRequestListener#onDetached(android.net.MacAddress,%20int)` is called.
When an incoming request is received,
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ExternalApproverRequestListener#onConnectionRequested(int,%20android.net.wifi.p2p.WifiP2pConfig,%20android.net.wifi.p2p.WifiP2pDevice)`
is called. When a WPS PIN or a Wi-Fi Direct R2 pairing bootstrapping PIN is generated,
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ExternalApproverRequestListener#onPinGenerated(android.net.MacAddress,%20java.lang.String)` is called.


The application must have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.


Requires `https://developer.android.com/reference/android/Manifest.permission#MANAGE_WIFI_NETWORK_SELECTION`

<br />

| Parameters ||
|---|---|
| `c` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)`. This value cannot be `null`. <br /> |
| `deviceAddress` | `MacAddress`: the peer which is bound to the external approver. This value cannot be `null`. <br /> |
| `listener` | `WifiP2pManager.ExternalApproverRequestListener`: for callback when the framework needs to notify the external approver. This value cannot be `null`. <br /> |

### addLocalService

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void addLocalService (WifiP2pManager.Channel channel, 
                WifiP2pServiceInfo servInfo, 
                WifiP2pManager.ActionListener listener)
```

Register a local service for service discovery. If a local service is registered,
the framework automatically responds to a service discovery request from a peer.

The function call immediately returns after sending a request to add a local
service to the framework. The application is notified of a success or failure to
add service through listener callbacks `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.

The service information is set through `https://developer.android.com/reference/android/net/wifi/p2p/nsd/WifiP2pServiceInfo`.  

or its subclass calls `https://developer.android.com/reference/android/net/wifi/p2p/nsd/WifiP2pUpnpServiceInfo#newInstance(java.lang.String,%20java.lang.String,%20java.util.List<java.lang.String>)` or
`https://developer.android.com/reference/android/net/wifi/p2p/nsd/WifiP2pDnsSdServiceInfo#newInstance(java.lang.String,%20java.lang.String,%20java.util.Map<java.lang.String,java.lang.String>)` for a Upnp or Bonjour service
respectively

The service information can be cleared with calls to
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#removeLocalService(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceInfo,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` or `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#clearLocalServices(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`.


If targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU` or later, the application must
have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

If targeting an earlier release than `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU`, the
application must have `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` <br /> |
| `servInfo` | `WifiP2pServiceInfo`: is a local service information. <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. Can be null. <br /> |

### addServiceRequest

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void addServiceRequest (WifiP2pManager.Channel channel, 
                WifiP2pServiceRequest req, 
                WifiP2pManager.ActionListener listener)
```

Add a service discovery request.

The function call immediately returns after sending a request to add service
discovery request to the framework. The application is notified of a success or failure to
add service through listener callbacks `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.

The USD based service information are set in the service request through
`https://developer.android.com/reference/android/net/wifi/p2p/nsd/WifiP2pServiceRequest#WifiP2pServiceRequest(android.net.wifi.p2p.nsd.WifiP2pUsdBasedServiceConfig)`.
Application must use `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isWiFiDirectR2Supported()` to determine whether the device
supports USD based service discovery. If `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isWiFiDirectR2Supported()` return
`false` then this method will throw `https://developer.android.com/reference/java/lang/UnsupportedOperationException` for service
request information containing USD service configuration.

After service discovery request is added, you can initiate service discovery by
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#discoverServices(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`.

The added service requests can be cleared with calls to
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#removeServiceRequest(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceRequest,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#clearServiceRequests(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` <br /> |
| `req` | `WifiP2pServiceRequest`: is the service discovery request. <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. Can be null. <br /> |

### cancelConnect

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void cancelConnect (WifiP2pManager.Channel channel, 
                WifiP2pManager.ActionListener listener)
```

Cancel any ongoing p2p group negotiation

The function call immediately returns after sending a connection cancellation request
to the framework. The application is notified of a success or failure to initiate
cancellation through listener callbacks `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. Can be null. <br /> |

### clearLocalServices

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void clearLocalServices (WifiP2pManager.Channel channel, 
                WifiP2pManager.ActionListener listener)
```

Clear all registered local services of service discovery.

The function call immediately returns after sending a request to clear all
local services to the framework. The application is notified of a success or failure to
add service through listener callbacks `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. Can be null. <br /> |

### clearServiceRequests

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void clearServiceRequests (WifiP2pManager.Channel channel, 
                WifiP2pManager.ActionListener listener)
```

Clear all registered service discovery requests.

The function call immediately returns after sending a request to clear all
service discovery requests to the framework. The application is notified of a success
or failure to add service through listener callbacks `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. Can be null. <br /> |

### connect

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void connect (WifiP2pManager.Channel channel, 
                WifiP2pConfig config, 
                WifiP2pManager.ActionListener listener)
```

Start a p2p connection to a device with the specified configuration.

The function call immediately returns after sending a connection request
to the framework. The application is notified of a success or failure to initiate
connect through listener callbacks `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.

An app should use `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig.Builder` to build the configuration
for this API, ex. call `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig.Builder#setDeviceAddress(android.net.MacAddress)`
to set the peer MAC address and `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig.Builder#enablePersistentMode(boolean)`
to configure the persistent mode.

Register for `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_CONNECTION_CHANGED_ACTION` intent to
determine when the framework notifies of a change in connectivity.

If the current device is not part of a p2p group, a connect request initiates
a group negotiation with the peer.

If the current device is part of an existing p2p group or has created
a p2p group with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#createGroup(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pConfig,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`, an invitation to join the group is sent to
the peer device.


If targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU` or later, the application must
have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

If targeting an earlier release than `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU`, the
application must have `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` <br /> |
| `config` | `WifiP2pConfig`: options as described in `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig` class <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. Can be null. <br /> |

### createGroup

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void createGroup (WifiP2pManager.Channel channel, 
                WifiP2pManager.ActionListener listener)
```

Create a p2p group with the current device as the group owner. This essentially creates
an access point that can accept connections from legacy clients as well as other p2p
devices.

**Note:**
This function would normally not be used unless the current device needs
to form a p2p connection with a legacy client

The function call immediately returns after sending a group creation request
to the framework. The application is notified of a success or failure to initiate
group creation through listener callbacks `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.

Application can request for the group details with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestGroupInfo(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.GroupInfoListener)`.


If targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU` or later, the application must
have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

If targeting an earlier release than `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU`, the
application must have `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. Can be null. <br /> |

### createGroup

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void createGroup (WifiP2pManager.Channel channel, 
                WifiP2pConfig config, 
                WifiP2pManager.ActionListener listener)
```

Create a p2p group with the current device as the group owner. This essentially creates
an access point that can accept connections from legacy clients as well as other p2p
devices.

An app should use `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig.Builder` to build the configuration
for a group.

**Note:**
This function would normally not be used unless the current device needs
to form a p2p group as a Group Owner and allow peers to join it as either
Group Clients or legacy Wi-Fi STAs.

The function call immediately returns after sending a group creation request
to the framework. The application is notified of a success or failure to initiate
group creation through listener callbacks `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.

Application can request for the group details with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestGroupInfo(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.GroupInfoListener)`.


If targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU` or later, the application must
have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

If targeting an earlier release than `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU`, the
application must have `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)`. This value cannot be `null`. <br /> |
| `config` | `WifiP2pConfig`: the configuration of a p2p group. This value may be `null`. <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. Can be null. <br /> |

### discoverPeers

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void discoverPeers (WifiP2pManager.Channel channel, 
                WifiP2pManager.ActionListener listener)
```

Initiate peer discovery. A discovery process involves scanning for available Wi-Fi peers
for the purpose of establishing a connection.

The function call immediately returns after sending a discovery request
to the framework. The application is notified of a success or failure to initiate
discovery through listener callbacks `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.

The discovery remains active until a connection is initiated or
a p2p group is formed. Register for `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_PEERS_CHANGED_ACTION` intent to
determine when the framework notifies of a change as peers are discovered.

Upon receiving a `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_PEERS_CHANGED_ACTION` intent, an application
can request the list of peers using `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestPeers(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.PeerListListener)`.


If targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU` or later, the application must
have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

If targeting an earlier release than `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU`, the
application must have `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. Can be null. <br /> |

### discoverPeersOnSocialChannels

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void discoverPeersOnSocialChannels (WifiP2pManager.Channel channel, 
                WifiP2pManager.ActionListener listener)
```

Scan only the social channels.

A discovery process involves scanning for available Wi-Fi peers
for the purpose of establishing a connection.

The function call immediately returns after sending a discovery request
to the framework. The application is notified of a success or failure to initiate
discovery through listener callbacks `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.

The discovery remains active until a connection is initiated or
a p2p group is formed. Register for `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_PEERS_CHANGED_ACTION` intent to
determine when the framework notifies of a change as peers are discovered.

Upon receiving a `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_PEERS_CHANGED_ACTION` intent, an application
can request the list of peers using `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestPeers(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.PeerListListener)`.


The application must have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.


Use `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isChannelConstrainedDiscoverySupported()` to determine whether the device
supports this feature. If `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isChannelConstrainedDiscoverySupported()` return
`false` then this method will throw `https://developer.android.com/reference/java/lang/UnsupportedOperationException`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` This value cannot be `null`. <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. This value may be `null`. <br /> |

### discoverPeersOnSpecificFrequency

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void discoverPeersOnSpecificFrequency (WifiP2pManager.Channel channel, 
                int frequencyMhz, 
                WifiP2pManager.ActionListener listener)
```

Scan only a single channel specified by frequency.

A discovery process involves scanning for available Wi-Fi peers
for the purpose of establishing a connection.

The function call immediately returns after sending a discovery request
to the framework. The application is notified of a success or failure to initiate
discovery through listener callbacks `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.

The discovery remains active until a connection is initiated or
a p2p group is formed. Register for `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_PEERS_CHANGED_ACTION` intent to
determine when the framework notifies of a change as peers are discovered.

Upon receiving a `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_PEERS_CHANGED_ACTION` intent, an application
can request the list of peers using `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#requestPeers(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.PeerListListener)`.


The application must have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.


Use `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isChannelConstrainedDiscoverySupported()` to determine whether the device
supports this feature. If `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isChannelConstrainedDiscoverySupported()` return
`false` then this method will throw `https://developer.android.com/reference/java/lang/UnsupportedOperationException`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` This value cannot be `null`. <br /> |
| `frequencyMhz` | `int`: is the frequency of the channel to use for peer discovery. <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. This value may be `null`. <br /> |

### discoverServices

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void discoverServices (WifiP2pManager.Channel channel, 
                WifiP2pManager.ActionListener listener)
```

Initiate service discovery. A discovery process involves scanning for
requested services for the purpose of establishing a connection to a peer
that supports an available service.

The function call immediately returns after sending a request to start service
discovery to the framework. The application is notified of a success or failure to initiate
discovery through listener callbacks `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.

The services to be discovered are specified with calls to `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#addServiceRequest(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceRequest,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`.

The application is notified of the response against the service discovery request
through listener callbacks registered by `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setServiceResponseListener(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ServiceResponseListener)` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setDnsSdResponseListeners(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.DnsSdServiceResponseListener,%20android.net.wifi.p2p.WifiP2pManager.DnsSdTxtRecordListener)`, or `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setUpnpServiceResponseListener(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.UpnpServiceResponseListener)`.


If targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU` or later, the application must
have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

If targeting an earlier release than `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU`, the
application must have `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. Can be null. <br /> |

### discoverUsdBasedServices

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void discoverUsdBasedServices (WifiP2pManager.Channel channel, 
                WifiP2pUsdBasedServiceDiscoveryConfig config, 
                WifiP2pManager.ActionListener listener)
```

Initiate Un-synchronized service discovery (USD) based service discovery. A discovery
process involves scanning for requested services for the purpose of establishing a
connection to a peer that supports an available service using USD protocol.

This method accepts a `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pUsdBasedServiceDiscoveryConfig` object specifying the
desired parameters for the service discovery. The configuration object allows to specify
either a band or frequency list to scan for service.

The function call immediately returns after sending a request to start service
discovery to the framework. The application is notified of a success or failure to initiate
discovery through listener callbacks `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.

The USD based services to be discovered are specified with calls to
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#addServiceRequest(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceRequest,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` with the service request information set through
`https://developer.android.com/reference/android/net/wifi/p2p/nsd/WifiP2pServiceRequest#WifiP2pServiceRequest(android.net.wifi.p2p.nsd.WifiP2pUsdBasedServiceConfig)`

The application is notified of the response against the service discovery request
via `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ServiceResponseListener#onUsdBasedServiceAvailable(android.net.wifi.p2p.WifiP2pDevice,%20android.net.wifi.p2p.nsd.WifiP2pUsdBasedServiceResponse)` listener callback registered by
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setServiceResponseListener(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ServiceResponseListener)` .


Use `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isWiFiDirectR2Supported()` to determine whether the device supports
this feature. If `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isWiFiDirectR2Supported()` return `false` then
this method will throw `https://developer.android.com/reference/java/lang/UnsupportedOperationException`.


The application must have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` This value cannot be `null`. <br /> |
| `config` | `WifiP2pUsdBasedServiceDiscoveryConfig`: is the configuration for this USD based service discovery. This value cannot be `null`. <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. Can be null. <br /> |

### getListenState

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void getListenState (WifiP2pManager.Channel c, 
                Executor executor, 
                Consumer<Integer> resultsCallback)
```

Get p2p listen state.

This state indicates whether p2p listen has started or stopped.
The valid value is one of `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_LISTEN_STOPPED` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_LISTEN_STARTED`.

This state is also included in the `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#ACTION_WIFI_P2P_LISTEN_STATE_CHANGED`
broadcast event with extra `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_LISTEN_STATE`.


If targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU` or later, the application must
have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

If targeting an earlier release than `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU`, the
application must have `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

<br />

| Parameters ||
|---|---|
| `c` | `WifiP2pManager.Channel`: It is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)`. This value cannot be `null`. <br /> |
| `executor` | `Executor`: The executor on which callback will be invoked. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `resultsCallback` | `Consumer`: A callback that will return listen state `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_LISTEN_STOPPED` or `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_LISTEN_STARTED` This value cannot be `null`. <br /> |

### getP2pMaxAllowedVendorElementsLengthBytes

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int getP2pMaxAllowedVendorElementsLengthBytes ()
```

Return the maximum total length (in bytes) of all Vendor specific information
elements (VSIEs) which can be set using the
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setVendorElements(android.net.wifi.p2p.WifiP2pManager.Channel,%20java.util.List<android.net.wifi.ScanResult.InformationElement>,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`.

The length is calculated adding the payload length + 2 bytes for each VSIE
(2 bytes: 1 byte for type and 1 byte for length).

<br />

| Returns ||
|---|---|
| `int` | <br /> |

### initialize

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public WifiP2pManager.Channel initialize (Context srcContext, 
                Looper srcLooper, 
                WifiP2pManager.ChannelListener listener)
```

Registers the application with the Wi-Fi framework. This function
must be the first to be called before any p2p operations are performed.

<br />

| Parameters ||
|---|---|
| `srcContext` | `Context`: is the context of the source <br /> |
| `srcLooper` | `Looper`: is the Looper on which the callbacks are receivied <br /> |
| `listener` | `WifiP2pManager.ChannelListener`: for callback at loss of framework communication. Can be null. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel` | Channel instance that is necessary for performing any further p2p operations <br /> |

### isChannelConstrainedDiscoverySupported

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isChannelConstrainedDiscoverySupported ()
```

Check if this device supports discovery limited to a specific frequency or
the social channels.

Gates whether
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#discoverPeersOnSpecificFrequency(android.net.wifi.p2p.WifiP2pManager.Channel,%20int,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` and
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#discoverPeersOnSocialChannels(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`
methods are functional on this device.

<br />

| Returns ||
|---|---|
| `boolean` | `true` if supported, `false` otherwise. <br /> |

### isGroupClientRemovalSupported

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isGroupClientRemovalSupported ()
```

Check if this device supports removing clients from a group.

Gates whether the
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#removeClient(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.MacAddress,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`
method is functional on this device.

<br />

| Returns ||
|---|---|
| `boolean` | `true` if supported, `false` otherwise. <br /> |

### isGroupOwnerIPv6LinkLocalAddressProvided

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isGroupOwnerIPv6LinkLocalAddressProvided ()
```

Checks whether this device, while being a group client, can discover and deliver the group
owner's IPv6 link-local address.

If this method returns `true` and
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#connect(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pConfig,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` method is called with
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig` having
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV6_LINK_LOCAL` as the group client
IP provisioning mode, then the group owner's IPv6 link-local address will be delivered in the
group client via `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_CONNECTION_CHANGED_ACTION` broadcast intent (i.e, group
owner address in `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_WIFI_P2P_INFO`).
If this method returns `false`, then IPv6 link-local addresses can still be used, but
it is the responsibility of the caller to discover that address in other ways, e.g. using
out-of-band communication.

<br />

| Returns ||
|---|---|
| `boolean` | `true` if supported, `false` otherwise. <br /> |

### isPccModeSupported

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isPccModeSupported ()
```

Check if this device supports P2P Connection Compatibility Mode(R1/R2 compatibility mode).

<br />

| Returns ||
|---|---|
| `boolean` | true if this device supports hosting an autonomous Group Owner which allows legacy P2P clients and R2 clients to join the group in PCC Mode and also supports connecting to a Group Owner either using legacy security mode (WPA2-PSK) or R2 mandated security mode(WPA3-SAE) in PCC Mode. <br /> |

### isSetVendorElementsSupported

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isSetVendorElementsSupported ()
```

Check if this device supports setting vendor elements.

Gates whether the
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setVendorElements(android.net.wifi.p2p.WifiP2pManager.Channel,%20java.util.List<android.net.wifi.ScanResult.InformationElement>,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`
method is functional on this device.

<br />

| Returns ||
|---|---|
| `boolean` | `true` if supported, `false` otherwise. <br /> |

### isWiFiDirectR2Supported

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isWiFiDirectR2Supported ()
```

Check if this device supports Wi-Fi Direct R2 (P2P2).

<br />

| Returns ||
|---|---|
| `boolean` | true if this device supports Wi-Fi Alliance Wi-Fi Direct R2 (Support for P2P2 IE and establishing connection by using the P2P pairing protocol), false otherwise. For more details, visit <https://www.wi-fi.org/> and search for "Wi-Fi Direct" . <br /> |

### registerWifiP2pListener

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void registerWifiP2pListener (Executor executor, 
                WifiP2pManager.WifiP2pListener listener)
```

Add a listener to listen to Wi-Fi p2p various changes.

<br />

| Parameters ||
|---|---|
| `executor` | `Executor`: the Executor on which to execute the callbacks. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `listener` | `WifiP2pManager.WifiP2pListener`: listener for the Wi-Fi p2p connection changes. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if incorrect input arguments are provided. |
| `https://developer.android.com/reference/java/lang/SecurityException` | if the caller is missing required permissions. |

### removeClient

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeClient (WifiP2pManager.Channel channel, 
                MacAddress peerAddress, 
                WifiP2pManager.ActionListener listener)
```

Remove the client with the MAC address from the group.

The function call immediately returns after sending a client removal request
to the framework. The application is notified of a success or failure to initiate
client removal through listener callbacks `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.

The callbacks are triggered on the thread specified when initializing the
`channel`, see `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)`.


Use `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isGroupClientRemovalSupported()` to determine whether the device supports
this feature. If `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isGroupClientRemovalSupported()` return `false` then this
method will throw `https://developer.android.com/reference/java/lang/UnsupportedOperationException`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` This value cannot be `null`. <br /> |
| `peerAddress` | `MacAddress`: MAC address of the client. This value cannot be `null`. <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. Can be null. <br /> |

### removeExternalApprover

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeExternalApprover (WifiP2pManager.Channel c, 
                MacAddress deviceAddress, 
                WifiP2pManager.ActionListener listener)
```

Remove the external approver for a specific peer.

The application must have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.


Requires `https://developer.android.com/reference/android/Manifest.permission#MANAGE_WIFI_NETWORK_SELECTION`

<br />

| Parameters ||
|---|---|
| `c` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)`. This value cannot be `null`. <br /> |
| `deviceAddress` | `MacAddress`: the peer which is bound to the external approver. This value cannot be `null`. <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callback on success or failure. This value may be `null`. <br /> |

### removeGroup

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeGroup (WifiP2pManager.Channel channel, 
                WifiP2pManager.ActionListener listener)
```

Remove the current p2p group.

The function call immediately returns after sending a group removal request
to the framework. The application is notified of a success or failure to initiate
group removal through listener callbacks `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. Can be null. <br /> |

### removeLocalService

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeLocalService (WifiP2pManager.Channel channel, 
                WifiP2pServiceInfo servInfo, 
                WifiP2pManager.ActionListener listener)
```

Remove a registered local service added with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#addLocalService(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceInfo,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`

The function call immediately returns after sending a request to remove a
local service to the framework. The application is notified of a success or failure to
add service through listener callbacks `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` <br /> |
| `servInfo` | `WifiP2pServiceInfo`: is the local service information. <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. Can be null. <br /> |

### removeServiceRequest

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeServiceRequest (WifiP2pManager.Channel channel, 
                WifiP2pServiceRequest req, 
                WifiP2pManager.ActionListener listener)
```

Remove a specified service discovery request added with `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#addServiceRequest(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceRequest,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`

The function call immediately returns after sending a request to remove service
discovery request to the framework. The application is notified of a success or failure to
add service through listener callbacks `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` <br /> |
| `req` | `WifiP2pServiceRequest`: is the service discovery request. <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. Can be null. <br /> |

### requestConnectionInfo

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestConnectionInfo (WifiP2pManager.Channel channel, 
                WifiP2pManager.ConnectionInfoListener listener)
```

Request device connection info.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` <br /> |
| `listener` | `WifiP2pManager.ConnectionInfoListener`: for callback when connection info is available. Can be null. <br /> |

### requestDeviceInfo

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestDeviceInfo (WifiP2pManager.Channel c, 
                WifiP2pManager.DeviceInfoListener listener)
```

Request Device Info

This method provides the device info
in the form of a `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDevice`.
Valid `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDevice` is returned when p2p is enabled.
To get information notifications on P2P getting enabled refers
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_STATE_ENABLED`.

This `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDevice` is returned using the
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.DeviceInfoListener` listener.

`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDevice#deviceAddress` is only available if the caller
holds the `android.Manifest.permission#LOCAL_MAC_ADDRESS` permission, and holds the
anonymized MAC address (02:00:00:00:00:00) otherwise.

This information is also included in the `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_THIS_DEVICE_CHANGED_ACTION`
broadcast event with extra `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_WIFI_P2P_DEVICE`.


If targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU` or later, the application must
have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

If targeting an earlier release than `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU`, the
application must have `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

<br />

| Parameters ||
|---|---|
| `c` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)`. This value cannot be `null`. <br /> |
| `listener` | `WifiP2pManager.DeviceInfoListener`: for callback when network info is available. This value cannot be `null`. <br /> |

### requestDirInfo

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestDirInfo (WifiP2pManager.Channel c, 
                Executor executor, 
                OutcomeReceiver<WifiP2pDirInfo, Exception> callback)
```

Get the Device Identity Resolution (DIR) Information.
See `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDirInfo` for details

Note: The results callback returns null if the device doesn't have any persistent group
with device identity key information.


Use `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isWiFiDirectR2Supported()` to determine whether the device supports
this feature. If `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isWiFiDirectR2Supported()` return `false` then
this method will throw `https://developer.android.com/reference/java/lang/UnsupportedOperationException`.


The caller must hold the `https://developer.android.com/` permission
to obtain `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDirInfo`. If the caller does not hold this permission,
`https://developer.android.com/reference/android/os/OutcomeReceiver#onError(E)` is called with a `https://developer.android.com/reference/java/lang/SecurityException`.


The application must have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

<br />

| Parameters ||
|---|---|
| `c` | `WifiP2pManager.Channel`: It is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)`. This value cannot be `null`. <br /> |
| `executor` | `Executor`: The executor on which callback will be invoked. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `callback` | `OutcomeReceiver`: An OutcomeReceiver callback for receiving `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDirInfo` via `https://developer.android.com/reference/android/os/OutcomeReceiver#onResult(R)`. This callback will return null when DIR info doesn't exist. When this API call fails due to permission issues, state machine is busy etc., `https://developer.android.com/reference/android/os/OutcomeReceiver#onError(E)` is called. <br /> |

### requestDiscoveryState

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestDiscoveryState (WifiP2pManager.Channel c, 
                WifiP2pManager.DiscoveryStateListener listener)
```

Request p2p discovery state.

This state indicates whether p2p discovery has started or stopped.
The valid value is one of `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_DISCOVERY_STARTED` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_DISCOVERY_STOPPED`. The state is returned using the
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.DiscoveryStateListener` listener.

This state is also included in the `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_DISCOVERY_CHANGED_ACTION`
broadcast event with extra `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_DISCOVERY_STATE`.

<br />

| Parameters ||
|---|---|
| `c` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)`. This value cannot be `null`. <br /> |
| `listener` | `WifiP2pManager.DiscoveryStateListener`: for callback when discovery state is available. This value cannot be `null`. <br /> |

### requestGroupInfo

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestGroupInfo (WifiP2pManager.Channel channel, 
                WifiP2pManager.GroupInfoListener listener)
```

Request p2p group info.


If targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU` or later, the application must
have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

If targeting an earlier release than `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU`, the
application must have `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` <br /> |
| `listener` | `WifiP2pManager.GroupInfoListener`: for callback when group info is available. Can be null. <br /> |

### requestNetworkInfo

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestNetworkInfo (WifiP2pManager.Channel c, 
                WifiP2pManager.NetworkInfoListener listener)
```

Request network info.

This method provides the network info in the form of a `https://developer.android.com/reference/android/net/NetworkInfo`.
`https://developer.android.com/reference/android/net/NetworkInfo#isAvailable()` indicates the p2p availability and
`https://developer.android.com/reference/android/net/NetworkInfo#getDetailedState()` reports the current fine-grained state
of the network. This `https://developer.android.com/reference/android/net/NetworkInfo` is returned using the
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.NetworkInfoListener` listener.

This information is also included in the `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_CONNECTION_CHANGED_ACTION`
broadcast event with extra `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_NETWORK_INFO`.

<br />

| Parameters ||
|---|---|
| `c` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)`. This value cannot be `null`. <br /> |
| `listener` | `WifiP2pManager.NetworkInfoListener`: for callback when network info is available. This value cannot be `null`. <br /> |

### requestP2pState

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestP2pState (WifiP2pManager.Channel c, 
                WifiP2pManager.P2pStateListener listener)
```

Request p2p enabled state.

This state indicates whether Wi-Fi p2p is enabled or disabled.
The valid value is one of `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_STATE_DISABLED` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_STATE_ENABLED`. The state is returned using the
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.P2pStateListener` listener.

This state is also included in the `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_STATE_CHANGED_ACTION`
broadcast event with extra `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#EXTRA_WIFI_STATE`.

<br />

| Parameters ||
|---|---|
| `c` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)`. This value cannot be `null`. <br /> |
| `listener` | `WifiP2pManager.P2pStateListener`: for callback when p2p state is available. This value cannot be `null`. <br /> |

### requestPeers

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestPeers (WifiP2pManager.Channel channel, 
                WifiP2pManager.PeerListListener listener)
```

Request the current list of peers.


If targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU` or later, the application must
have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

If targeting an earlier release than `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU`, the
application must have `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` <br /> |
| `listener` | `WifiP2pManager.PeerListListener`: for callback when peer list is available. Can be null. <br /> |

### setConnectionRequestResult

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setConnectionRequestResult (WifiP2pManager.Channel c, 
                MacAddress deviceAddress, 
                int result, 
                String pinOrPassword, 
                WifiP2pManager.ActionListener listener)
```

Set the result with PIN for the incoming request from a specific peer.

The application must have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.


Requires `https://developer.android.com/reference/android/Manifest.permission#MANAGE_WIFI_NETWORK_SELECTION`

<br />

| Parameters ||
|---|---|
| `c` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)`. This value cannot be `null`. <br /> |
| `deviceAddress` | `MacAddress`: the peer which is bound to the external approver. This value cannot be `null`. <br /> |
| `result` | `int`: the response for the incoming request. Value is one of the following: - `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#CONNECTION_REQUEST_ACCEPT` - `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#CONNECTION_REQUEST_REJECT` - `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#CONNECTION_REQUEST_DEFER_TO_SERVICE` - `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#CONNECTION_REQUEST_DEFER_SHOW_PIN_TO_SERVICE` - `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#CONNECTION_REQUEST_DEFER_SHOW_PASSWORD_TO_SERVICE` |
| `pinOrPassword` | `String`: the WPS PIN or Wi-Fi Direct R2 pairing bootstrapping PIN/Password for the incoming request. This value may be `null`. <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callback on success or failure. This value may be `null`. <br /> |

### setConnectionRequestResult

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setConnectionRequestResult (WifiP2pManager.Channel c, 
                MacAddress deviceAddress, 
                int result, 
                WifiP2pManager.ActionListener listener)
```

Set the result for the incoming request from a specific peer.

The application must have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.


Requires `https://developer.android.com/reference/android/Manifest.permission#MANAGE_WIFI_NETWORK_SELECTION`

<br />

| Parameters ||
|---|---|
| `c` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)`. This value cannot be `null`. <br /> |
| `deviceAddress` | `MacAddress`: the peer which is bound to the external approver. This value cannot be `null`. <br /> |
| `result` | `int`: the response for the incoming request. Value is one of the following: - `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#CONNECTION_REQUEST_ACCEPT` - `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#CONNECTION_REQUEST_REJECT` - `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#CONNECTION_REQUEST_DEFER_TO_SERVICE` - `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#CONNECTION_REQUEST_DEFER_SHOW_PIN_TO_SERVICE` - `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#CONNECTION_REQUEST_DEFER_SHOW_PASSWORD_TO_SERVICE` |
| `listener` | `WifiP2pManager.ActionListener`: for callback on success or failure. This value may be `null`. <br /> |

### setDnsSdResponseListeners

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setDnsSdResponseListeners (WifiP2pManager.Channel channel, 
                WifiP2pManager.DnsSdServiceResponseListener servListener, 
                WifiP2pManager.DnsSdTxtRecordListener txtListener)
```

Register a callback to be invoked on receiving Bonjour service discovery
response.

see `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#discoverServices(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` for the detail.

<br />

| Parameters ||
|---|---|
| `servListener` | `WifiP2pManager.DnsSdServiceResponseListener`: is for listening to a Bonjour service response <br /> |
| `txtListener` | `WifiP2pManager.DnsSdTxtRecordListener`: is for listening to a Bonjour TXT record response <br /> |

### setServiceResponseListener

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setServiceResponseListener (WifiP2pManager.Channel channel, 
                WifiP2pManager.ServiceResponseListener listener)
```

Register a callback to be invoked on receiving service discovery response.
Used only for vendor specific protocol right now. For Bonjour or Upnp, use
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setDnsSdResponseListeners(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.DnsSdServiceResponseListener,%20android.net.wifi.p2p.WifiP2pManager.DnsSdTxtRecordListener)` or `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#setUpnpServiceResponseListener(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.UpnpServiceResponseListener)`
respectively.

see `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#discoverServices(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` for the detail.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` <br /> |
| `listener` | `WifiP2pManager.ServiceResponseListener`: for callbacks on receiving service discovery response. <br /> |

### setUpnpServiceResponseListener

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setUpnpServiceResponseListener (WifiP2pManager.Channel channel, 
                WifiP2pManager.UpnpServiceResponseListener listener)
```

Register a callback to be invoked on receiving upnp service discovery
response.

see `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#discoverServices(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` for the detail.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` <br /> |
| `listener` | `WifiP2pManager.UpnpServiceResponseListener`: for callbacks on receiving service discovery response. <br /> |

### setVendorElements

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setVendorElements (WifiP2pManager.Channel c, 
                List<ScanResult.InformationElement> vendorElements, 
                WifiP2pManager.ActionListener listener)
```

Set/Clear vendor specific information elements (VSIEs) to be published during
Wi-Fi Direct (P2P) discovery.

Once `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.Channel#close()` is called, the vendor information elements will be cleared from
framework. The information element format is defined in the IEEE 802.11-2016 spec
Table 9-77.


To clear the previously set vendor elements, call this API with an empty List.


The maximum accumulated length of all VSIEs must be before the limit specified by
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#getP2pMaxAllowedVendorElementsLengthBytes()`.


To publish vendor elements, this API should be called before peer discovery API, ex.
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#discoverPeers(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`.


Use `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isSetVendorElementsSupported()` to determine whether the device supports
this feature. If `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isSetVendorElementsSupported()` return `false` then
this method will throw `https://developer.android.com/reference/java/lang/UnsupportedOperationException`.


Requires `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` and `https://developer.android.com/reference/android/Manifest.permission#OVERRIDE_WIFI_CONFIG`

<br />

| Parameters ||
|---|---|
| `c` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)`. This value cannot be `null`. <br /> |
| `vendorElements` | `List`: application information as vendor-specific information elements. This value cannot be `null`. <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callback when network info is available. This value may be `null`. <br /> |

### setWfdInfo

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setWfdInfo (WifiP2pManager.Channel channel, 
                WifiP2pWfdInfo wfdInfo, 
                WifiP2pManager.ActionListener listener)
```

Set Wifi Display information.


Requires `https://developer.android.com/reference/android/Manifest.permission#CONFIGURE_WIFI_DISPLAY`

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` This value cannot be `null`. <br /> |
| `wfdInfo` | `WifiP2pWfdInfo`: the Wifi Display information to set. This value cannot be `null`. <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. Can be null. <br /> |

### startListening

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void startListening (WifiP2pManager.Channel channel, 
                WifiP2pManager.ActionListener listener)
```

Force p2p to enter listen state.

When this API is called, this device will periodically enter LISTENING state until
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#stopListening(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#stopPeerDiscovery(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` are called.
While in LISTENING state, this device will dwell at its social channel and respond
to probe requests from other Wi-Fi Direct peers.


If targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU` or later, the application must
have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

If targeting an earlier release than `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU`, the
application must have `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` This value cannot be `null`. <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. This value may be `null`. <br /> |

### startPeerDiscovery

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void startPeerDiscovery (WifiP2pManager.Channel channel, 
                WifiP2pDiscoveryConfig config, 
                WifiP2pManager.ActionListener listener)
```

Initiate peer discovery. A discovery process involves scanning for available Wi-Fi peers
for the purpose of establishing a connection. See `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#discoverPeers(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` for more details.

This method accepts a `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDiscoveryConfig` object specifying the desired
parameters for the peer discovery. The configuration object allows the specification of the
scan type (ex. FULL, SOCIAL) and the inclusion of vendor-specific configuration data.

The application must have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` This value cannot be `null`. <br /> |
| `config` | `WifiP2pDiscoveryConfig`: is the configuration for this peer discovery. This value cannot be `null`. <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. This value may be `null`. <br /> |

### startUsdBasedLocalServiceAdvertisement

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void startUsdBasedLocalServiceAdvertisement (WifiP2pManager.Channel channel, 
                WifiP2pServiceInfo servInfo, 
                WifiP2pUsdBasedLocalServiceAdvertisementConfig config, 
                WifiP2pManager.ActionListener listener)
```

Start a service discovery advertisement using Un-synchronized service discovery (USD).
Once `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#startUsdBasedLocalServiceAdvertisement(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceInfo,%20android.net.wifi.p2p.WifiP2pUsdBasedLocalServiceAdvertisementConfig,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` is called, the device will
go to the channel frequency requested via
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pUsdBasedLocalServiceAdvertisementConfig` and responds to a service discovery
request from a peer.

The service information is set through
`https://developer.android.com/reference/android/net/wifi/p2p/nsd/WifiP2pServiceInfo#WifiP2pServiceInfo(android.net.wifi.p2p.nsd.WifiP2pUsdBasedServiceConfig)`

The function call immediately returns after sending a request to start the service
advertisement to the framework. The application is notified of a success or failure to
start service advertisement through listener callbacks `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.

The service information can be cleared with calls to
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#removeLocalService(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.nsd.WifiP2pServiceInfo,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` or `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#clearLocalServices(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`.


Use `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isWiFiDirectR2Supported()` to determine whether the device supports
this feature. If `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isWiFiDirectR2Supported()` return `false` then
this method will throw `https://developer.android.com/reference/java/lang/UnsupportedOperationException`.


The application must have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` This value cannot be `null`. <br /> |
| `servInfo` | `WifiP2pServiceInfo`: is a local service information. This value cannot be `null`. <br /> |
| `config` | `WifiP2pUsdBasedLocalServiceAdvertisementConfig`: is the configuration for this service discovery advertisement. This value cannot be `null`. <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. Can be null. <br /> |

### stopListening

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void stopListening (WifiP2pManager.Channel channel, 
                WifiP2pManager.ActionListener listener)
```

Force p2p to exit listen state.

When this API is called, this device will stop entering LISTENING state periodically
which is triggered by `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#startListening(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`.
If there are running peer discovery which is triggered by
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#discoverPeers(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)` or running service discovery which is
triggered by `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#discoverServices(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`, they will be stopped
as well.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` This value cannot be `null`. <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. This value may be `null`. <br /> |

### stopPeerDiscovery

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void stopPeerDiscovery (WifiP2pManager.Channel channel, 
                WifiP2pManager.ActionListener listener)
```

Stop an ongoing peer discovery

The function call immediately returns after sending a stop request
to the framework. The application is notified of a success or failure to initiate
stop through listener callbacks `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onSuccess()` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.ActionListener#onFailure(int)`.

If P2P Group is in the process of being created, this call will fail (report failure via
`listener`. The applicantion should listen to
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_CONNECTION_CHANGED_ACTION` to ensure the state is not
`https://developer.android.com/reference/android/net/NetworkInfo.State#CONNECTING` and repeat calling when the state changes.

<br />

| Parameters ||
|---|---|
| `channel` | `WifiP2pManager.Channel`: is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)` <br /> |
| `listener` | `WifiP2pManager.ActionListener`: for callbacks on success or failure. Can be null. <br /> |

### unregisterWifiP2pListener

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void unregisterWifiP2pListener (WifiP2pManager.WifiP2pListener listener)
```

Remove a listener added using
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#registerWifiP2pListener(java.util.concurrent.Executor,%20android.net.wifi.p2p.WifiP2pManager.WifiP2pListener)`

<br />

| Parameters ||
|---|---|
| `listener` | `WifiP2pManager.WifiP2pListener`: the listener to be removed. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if incorrect input arguments are provided. |

### validateDirInfo

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void validateDirInfo (WifiP2pManager.Channel c, 
                WifiP2pDirInfo dirInfo, 
                Executor executor, 
                OutcomeReceiver<Boolean, Exception> callback)
```

Validate the Device Identity Resolution (DIR) Information of a P2P device.
See `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDirInfo` for details.
Framework takes the `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDirInfo` and derives a set of Tag values based on
the cached Device Identity Keys (DevIK) of all paired peers saved in the device.
If a derived Tag value matches the Tag value received in the `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDirInfo`, the
device is identified as a paired peer and returns true.


Use `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isWiFiDirectR2Supported()` to determine whether the device supports
this feature. If `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isWiFiDirectR2Supported()` return `false` then
this method will throw `https://developer.android.com/reference/java/lang/UnsupportedOperationException`.


The application must have `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with
android:usesPermissionFlags="neverForLocation". If the application does not declare
android:usesPermissionFlags="neverForLocation", then it must also have
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.

<br />

| Parameters ||
|---|---|
| `c` | `WifiP2pManager.Channel`: It is the channel created at `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#initialize(android.content.Context,%20android.os.Looper,%20android.net.wifi.p2p.WifiP2pManager.ChannelListener)`. This value cannot be `null`. <br /> |
| `dirInfo` | `WifiP2pDirInfo`: `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDirInfo` to validate. This value cannot be `null`. <br /> |
| `executor` | `Executor`: The executor on which callback will be invoked. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `callback` | `OutcomeReceiver`: An OutcomeReceiver callback for receiving the result via `https://developer.android.com/reference/android/os/OutcomeReceiver#onResult(R)` indicating whether the DIR info of P2P device is of a paired device. {code true} for paired, `false` for not paired. When this API call fails due to permission issues, state machine is busy etc., `https://developer.android.com/reference/android/os/OutcomeReceiver#onError(E)` is called. This value cannot be `null`. <br /> |