WifiP2pManagerpublic class WifiP2pManager extends Object 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
{@link #initialize} before doing any p2p operation.
Most application calls need a {@link ActionListener} instance for receiving callbacks
{@link ActionListener#onSuccess} or {@link ActionListener#onFailure}. 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 {@link #ERROR}, {@link #P2P_UNSUPPORTED}
or {@link #BUSY}.
An application can initiate discovery of peers with {@link #discoverPeers}. 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 {@link #stopPeerDiscovery}.
Applications can listen to {@link #WIFI_P2P_DISCOVERY_CHANGED_ACTION} to know if a peer-to-peer
discovery is running or stopped. Additionally, {@link #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 {@link #requestPeers}. When the peer list is available
{@link PeerListListener#onPeersAvailable} is called with the device list.
An application can initiate a connection request to a peer through {@link #connect}. See
{@link 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 {@link #createGroup}
which creates an access point whose details can be fetched with {@link #requestGroupInfo}.
After a successful group formation through {@link #createGroup} or through {@link #connect},
use {@link #requestConnectionInfo} to fetch the connection details. The connection info
{@link WifiP2pInfo} contains the address of the group owner
{@link WifiP2pInfo#groupOwnerAddress} and a flag {@link 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.
With peer discovery using {@link #discoverPeers}, 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
{@link #addLocalService}. 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 {@link #removeLocalService} removes a local
service and {@link #clearLocalServices} 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 {@link #discoverServices}. Prior to initiating the discovery,
application can add service discovery request with a call to {@link #addServiceRequest},
remove a service discovery request with a call to {@link #removeServiceRequest} or clear
all requests with a call to {@link #clearServiceRequests}. 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 {@link #setDnsSdResponseListeners} for Bonjour or
{@link #setUpnpServiceResponseListener} for Upnp.
Note:
Registering an application handler with {@link #initialize} requires the permissions
{@link android.Manifest.permission#ACCESS_WIFI_STATE} and
{@link android.Manifest.permission#CHANGE_WIFI_STATE} to perform any further peer-to-peer
operations.
Get an instance of this class by calling {@link android.content.Context#getSystemService(String)
Context.getSystemService(Context.WIFI_P2P_SERVICE)}.
{@see WifiP2pConfig}
{@see WifiP2pInfo}
{@see WifiP2pGroup}
{@see WifiP2pDevice}
{@see WifiP2pDeviceList}
{@see android.net.wifi.WpsInfo} |
Fields Summary |
---|
private static final String | TAG | public static final String | WIFI_P2P_STATE_CHANGED_ACTIONBroadcast intent action to indicate whether Wi-Fi p2p is enabled or disabled. An
extra {@link #EXTRA_WIFI_STATE} provides the state information as int. | public static final String | EXTRA_WIFI_STATEThe lookup key for an int that indicates whether Wi-Fi p2p is enabled or disabled.
Retrieve it with {@link android.content.Intent#getIntExtra(String,int)}. | public static final int | WIFI_P2P_STATE_DISABLEDWi-Fi p2p is disabled. | public static final int | WIFI_P2P_STATE_ENABLEDWi-Fi p2p is enabled. | public static final String | WIFI_P2P_CONNECTION_CHANGED_ACTIONBroadcast intent action indicating that the state of Wi-Fi p2p connectivity
has changed. One extra {@link #EXTRA_WIFI_P2P_INFO} provides the p2p connection info in
the form of a {@link WifiP2pInfo} object. Another extra {@link #EXTRA_NETWORK_INFO} provides
the network info in the form of a {@link android.net.NetworkInfo}. A third extra provides
the details of the group. | public static final String | EXTRA_WIFI_P2P_INFOThe lookup key for a {@link android.net.wifi.p2p.WifiP2pInfo} object
Retrieve with {@link android.content.Intent#getParcelableExtra(String)}. | public static final String | EXTRA_NETWORK_INFOThe lookup key for a {@link android.net.NetworkInfo} object associated with the
p2p network. Retrieve with
{@link android.content.Intent#getParcelableExtra(String)}. | public static final String | EXTRA_WIFI_P2P_GROUPThe lookup key for a {@link android.net.wifi.p2p.WifiP2pGroup} object
associated with the p2p network. Retrieve with
{@link android.content.Intent#getParcelableExtra(String)}. | public static final String | WIFI_P2P_PEERS_CHANGED_ACTIONBroadcast intent action indicating that the available peer list has changed. This
can be sent as a result of peers being found, lost or updated.
An extra {@link #EXTRA_P2P_DEVICE_LIST} provides the full list of
current peers. The full list of peers can also be obtained any time with
{@link #requestPeers}. | public static final String | EXTRA_P2P_DEVICE_LISTThe lookup key for a {@link android.net.wifi.p2p.WifiP2pDeviceList} object representing
the new peer list when {@link #WIFI_P2P_PEERS_CHANGED_ACTION} broadcast is sent.
Retrieve with {@link android.content.Intent#getParcelableExtra(String)}. | public static final String | WIFI_P2P_DISCOVERY_CHANGED_ACTIONBroadcast intent action indicating that peer discovery has either started or stopped.
One extra {@link #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. | public static final String | EXTRA_DISCOVERY_STATEThe lookup key for an int that indicates whether p2p discovery has started or stopped.
Retrieve it with {@link android.content.Intent#getIntExtra(String,int)}. | public static final int | WIFI_P2P_DISCOVERY_STOPPEDp2p discovery has stopped | public static final int | WIFI_P2P_DISCOVERY_STARTEDp2p discovery has started | public static final String | WIFI_P2P_THIS_DEVICE_CHANGED_ACTIONBroadcast intent action indicating that this device details have changed. | public static final String | EXTRA_WIFI_P2P_DEVICEThe lookup key for a {@link android.net.wifi.p2p.WifiP2pDevice} object
Retrieve with {@link android.content.Intent#getParcelableExtra(String)}. | public static final String | WIFI_P2P_PERSISTENT_GROUPS_CHANGED_ACTIONBroadcast intent action indicating that remembered persistent groups have changed. | public static final String | EXTRA_HANDOVER_MESSAGEThe lookup key for a handover message returned by the WifiP2pService. | IWifiP2pManager | mService | private static final int | BASE | public static final int | DISCOVER_PEERS | public static final int | DISCOVER_PEERS_FAILED | public static final int | DISCOVER_PEERS_SUCCEEDED | public static final int | STOP_DISCOVERY | public static final int | STOP_DISCOVERY_FAILED | public static final int | STOP_DISCOVERY_SUCCEEDED | public static final int | CONNECT | public static final int | CONNECT_FAILED | public static final int | CONNECT_SUCCEEDED | public static final int | CANCEL_CONNECT | public static final int | CANCEL_CONNECT_FAILED | public static final int | CANCEL_CONNECT_SUCCEEDED | public static final int | CREATE_GROUP | public static final int | CREATE_GROUP_FAILED | public static final int | CREATE_GROUP_SUCCEEDED | public static final int | REMOVE_GROUP | public static final int | REMOVE_GROUP_FAILED | public static final int | REMOVE_GROUP_SUCCEEDED | public static final int | REQUEST_PEERS | public static final int | RESPONSE_PEERS | public static final int | REQUEST_CONNECTION_INFO | public static final int | RESPONSE_CONNECTION_INFO | public static final int | REQUEST_GROUP_INFO | public static final int | RESPONSE_GROUP_INFO | public static final int | ADD_LOCAL_SERVICE | public static final int | ADD_LOCAL_SERVICE_FAILED | public static final int | ADD_LOCAL_SERVICE_SUCCEEDED | public static final int | REMOVE_LOCAL_SERVICE | public static final int | REMOVE_LOCAL_SERVICE_FAILED | public static final int | REMOVE_LOCAL_SERVICE_SUCCEEDED | public static final int | CLEAR_LOCAL_SERVICES | public static final int | CLEAR_LOCAL_SERVICES_FAILED | public static final int | CLEAR_LOCAL_SERVICES_SUCCEEDED | public static final int | ADD_SERVICE_REQUEST | public static final int | ADD_SERVICE_REQUEST_FAILED | public static final int | ADD_SERVICE_REQUEST_SUCCEEDED | public static final int | REMOVE_SERVICE_REQUEST | public static final int | REMOVE_SERVICE_REQUEST_FAILED | public static final int | REMOVE_SERVICE_REQUEST_SUCCEEDED | public static final int | CLEAR_SERVICE_REQUESTS | public static final int | CLEAR_SERVICE_REQUESTS_FAILED | public static final int | CLEAR_SERVICE_REQUESTS_SUCCEEDED | public static final int | DISCOVER_SERVICES | public static final int | DISCOVER_SERVICES_FAILED | public static final int | DISCOVER_SERVICES_SUCCEEDED | public static final int | PING | public static final int | RESPONSE_SERVICE | public static final int | SET_DEVICE_NAME | public static final int | SET_DEVICE_NAME_FAILED | public static final int | SET_DEVICE_NAME_SUCCEEDED | public static final int | DELETE_PERSISTENT_GROUP | public static final int | DELETE_PERSISTENT_GROUP_FAILED | public static final int | DELETE_PERSISTENT_GROUP_SUCCEEDED | public static final int | REQUEST_PERSISTENT_GROUP_INFO | public static final int | RESPONSE_PERSISTENT_GROUP_INFO | public static final int | SET_WFD_INFO | public static final int | SET_WFD_INFO_FAILED | public static final int | SET_WFD_INFO_SUCCEEDED | public static final int | START_WPS | public static final int | START_WPS_FAILED | public static final int | START_WPS_SUCCEEDED | public static final int | START_LISTEN | public static final int | START_LISTEN_FAILED | public static final int | START_LISTEN_SUCCEEDED | public static final int | STOP_LISTEN | public static final int | STOP_LISTEN_FAILED | public static final int | STOP_LISTEN_SUCCEEDED | public static final int | SET_CHANNEL | public static final int | SET_CHANNEL_FAILED | public static final int | SET_CHANNEL_SUCCEEDED | public static final int | GET_HANDOVER_REQUEST | public static final int | GET_HANDOVER_SELECT | public static final int | RESPONSE_GET_HANDOVER_MESSAGE | public static final int | INITIATOR_REPORT_NFC_HANDOVER | public static final int | RESPONDER_REPORT_NFC_HANDOVER | public static final int | REPORT_NFC_HANDOVER_SUCCEEDED | public static final int | REPORT_NFC_HANDOVER_FAILED | public static final int | ERRORPassed with {@link ActionListener#onFailure}.
Indicates that the operation failed due to an internal error. | public static final int | P2P_UNSUPPORTEDPassed with {@link ActionListener#onFailure}.
Indicates that the operation failed because p2p is unsupported on the device. | public static final int | BUSYPassed with {@link ActionListener#onFailure}.
Indicates that the operation failed because the framework is busy and
unable to service the request | public static final int | NO_SERVICE_REQUESTSPassed with {@link ActionListener#onFailure}.
Indicates that the {@link #discoverServices} failed because no service
requests are added. Use {@link #addServiceRequest} to add a service
request. | public static final int | MIRACAST_DISABLED | public static final int | MIRACAST_SOURCE | public static final int | MIRACAST_SINK |
Constructors Summary |
---|
public WifiP2pManager(IWifiP2pManager service)Create a new WifiP2pManager instance. Applications use
{@link android.content.Context#getSystemService Context.getSystemService()} to retrieve
the standard {@link android.content.Context#WIFI_P2P_SERVICE Context.WIFI_P2P_SERVICE}.
mService = service;
|
Methods Summary |
---|
public void | addLocalService(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.p2p.nsd.WifiP2pServiceInfo servInfo, android.net.wifi.p2p.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 {@link ActionListener#onSuccess} or
{@link ActionListener#onFailure}.
The service information is set through {@link WifiP2pServiceInfo}.
or its subclass calls {@link WifiP2pUpnpServiceInfo#newInstance} or
{@link WifiP2pDnsSdServiceInfo#newInstance} for a Upnp or Bonjour service
respectively
The service information can be cleared with calls to
{@link #removeLocalService} or {@link #clearLocalServices}.
checkChannel(c);
checkServiceInfo(servInfo);
c.mAsyncChannel.sendMessage(ADD_LOCAL_SERVICE, 0, c.putListener(listener), servInfo);
| public void | addServiceRequest(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.p2p.nsd.WifiP2pServiceRequest req, android.net.wifi.p2p.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 {@link ActionListener#onSuccess} or
{@link ActionListener#onFailure}.
After service discovery request is added, you can initiate service discovery by
{@link #discoverServices}.
The added service requests can be cleared with calls to
{@link #removeServiceRequest(Channel, WifiP2pServiceRequest, ActionListener)} or
{@link #clearServiceRequests(Channel, ActionListener)}.
checkChannel(c);
checkServiceRequest(req);
c.mAsyncChannel.sendMessage(ADD_SERVICE_REQUEST, 0,
c.putListener(listener), req);
| public void | cancelConnect(android.net.wifi.p2p.WifiP2pManager$Channel c, 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. The application is notified of a success or failure to initiate
cancellation through listener callbacks {@link ActionListener#onSuccess} or
{@link ActionListener#onFailure}.
checkChannel(c);
c.mAsyncChannel.sendMessage(CANCEL_CONNECT, 0, c.putListener(listener));
| private static void | checkChannel(android.net.wifi.p2p.WifiP2pManager$Channel c)
if (c == null) throw new IllegalArgumentException("Channel needs to be initialized");
| private static void | checkP2pConfig(WifiP2pConfig c)
if (c == null) throw new IllegalArgumentException("config cannot be null");
if (TextUtils.isEmpty(c.deviceAddress)) {
throw new IllegalArgumentException("deviceAddress cannot be empty");
}
| private static void | checkServiceInfo(android.net.wifi.p2p.nsd.WifiP2pServiceInfo info)
if (info == null) throw new IllegalArgumentException("service info is null");
| private static void | checkServiceRequest(android.net.wifi.p2p.nsd.WifiP2pServiceRequest req)
if (req == null) throw new IllegalArgumentException("service request is null");
| public void | clearLocalServices(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.p2p.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 {@link ActionListener#onSuccess} or
{@link ActionListener#onFailure}.
checkChannel(c);
c.mAsyncChannel.sendMessage(CLEAR_LOCAL_SERVICES, 0, c.putListener(listener));
| public void | clearServiceRequests(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.p2p.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 {@link ActionListener#onSuccess} or
{@link ActionListener#onFailure}.
checkChannel(c);
c.mAsyncChannel.sendMessage(CLEAR_SERVICE_REQUESTS,
0, c.putListener(listener));
| public void | connect(android.net.wifi.p2p.WifiP2pManager$Channel c, WifiP2pConfig config, android.net.wifi.p2p.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 {@link ActionListener#onSuccess} or
{@link ActionListener#onFailure}.
Register for {@link #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 {@link #createGroup}, an invitation to join the group is sent to
the peer device.
checkChannel(c);
checkP2pConfig(config);
c.mAsyncChannel.sendMessage(CONNECT, 0, c.putListener(listener), config);
| public void | createGroup(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.p2p.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 {@link ActionListener#onSuccess} or
{@link ActionListener#onFailure}.
Application can request for the group details with {@link #requestGroupInfo}.
checkChannel(c);
c.mAsyncChannel.sendMessage(CREATE_GROUP, WifiP2pGroup.PERSISTENT_NET_ID,
c.putListener(listener));
| public void | deletePersistentGroup(android.net.wifi.p2p.WifiP2pManager$Channel c, int netId, android.net.wifi.p2p.WifiP2pManager$ActionListener listener)Delete a stored persistent group from the system settings.
The function call immediately returns after sending a persistent group removal request
to the framework. The application is notified of a success or failure to initiate
group removal through listener callbacks {@link ActionListener#onSuccess} or
{@link ActionListener#onFailure}.
The persistent p2p group list stored in the system can be obtained by
{@link #requestPersistentGroupInfo(Channel, PersistentGroupInfoListener)} and
a network id can be obtained by {@link WifiP2pGroup#getNetworkId()}.
checkChannel(c);
c.mAsyncChannel.sendMessage(DELETE_PERSISTENT_GROUP, netId, c.putListener(listener));
| public void | discoverPeers(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.p2p.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 {@link ActionListener#onSuccess} or
{@link ActionListener#onFailure}.
The discovery remains active until a connection is initiated or
a p2p group is formed. Register for {@link #WIFI_P2P_PEERS_CHANGED_ACTION} intent to
determine when the framework notifies of a change as peers are discovered.
Upon receiving a {@link #WIFI_P2P_PEERS_CHANGED_ACTION} intent, an application
can request for the list of peers using {@link #requestPeers}.
checkChannel(c);
c.mAsyncChannel.sendMessage(DISCOVER_PEERS, 0, c.putListener(listener));
| public void | discoverServices(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.p2p.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 {@link ActionListener#onSuccess} or
{@link ActionListener#onFailure}.
The services to be discovered are specified with calls to {@link #addServiceRequest}.
The application is notified of the response against the service discovery request
through listener callbacks registered by {@link #setServiceResponseListener} or
{@link #setDnsSdResponseListeners}, or {@link #setUpnpServiceResponseListener}.
checkChannel(c);
c.mAsyncChannel.sendMessage(DISCOVER_SERVICES, 0, c.putListener(listener));
| public android.os.Messenger | getMessenger()Get a reference to WifiP2pService handler. This is used to establish
an AsyncChannel communication with WifiService
try {
return mService.getMessenger();
} catch (RemoteException e) {
return null;
}
| public void | getNfcHandoverRequest(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.p2p.WifiP2pManager$HandoverMessageListener listener)Get a handover request message for use in WFA NFC Handover transfer.
checkChannel(c);
c.mAsyncChannel.sendMessage(GET_HANDOVER_REQUEST, 0, c.putListener(listener));
| public void | getNfcHandoverSelect(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.p2p.WifiP2pManager$HandoverMessageListener listener)Get a handover select message for use in WFA NFC Handover transfer.
checkChannel(c);
c.mAsyncChannel.sendMessage(GET_HANDOVER_SELECT, 0, c.putListener(listener));
| public android.os.Messenger | getP2pStateMachineMessenger()Get a reference to P2pStateMachine handler. This is used to establish
a priveleged AsyncChannel communication with WifiP2pService.
try {
return mService.getP2pStateMachineMessenger();
} catch (RemoteException e) {
return null;
}
| private android.net.wifi.p2p.WifiP2pManager$Channel | initalizeChannel(android.content.Context srcContext, android.os.Looper srcLooper, android.net.wifi.p2p.WifiP2pManager$ChannelListener listener, android.os.Messenger messenger)
if (messenger == null) return null;
Channel c = new Channel(srcContext, srcLooper, listener);
if (c.mAsyncChannel.connectSync(srcContext, c.mHandler, messenger)
== AsyncChannel.STATUS_SUCCESSFUL) {
return c;
} else {
return null;
}
| public android.net.wifi.p2p.WifiP2pManager$Channel | initialize(android.content.Context srcContext, android.os.Looper srcLooper, android.net.wifi.p2p.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.
return initalizeChannel(srcContext, srcLooper, listener, getMessenger());
| public android.net.wifi.p2p.WifiP2pManager$Channel | initializeInternal(android.content.Context srcContext, android.os.Looper srcLooper, android.net.wifi.p2p.WifiP2pManager$ChannelListener listener)Registers the application with the Wi-Fi framework. Enables system-only functionality.
return initalizeChannel(srcContext, srcLooper, listener, getP2pStateMachineMessenger());
| public void | initiatorReportNfcHandover(android.net.wifi.p2p.WifiP2pManager$Channel c, java.lang.String handoverSelect, android.net.wifi.p2p.WifiP2pManager$ActionListener listener)
checkChannel(c);
Bundle bundle = new Bundle();
bundle.putString(EXTRA_HANDOVER_MESSAGE, handoverSelect);
c.mAsyncChannel.sendMessage(INITIATOR_REPORT_NFC_HANDOVER, 0,
c.putListener(listener), bundle);
| public void | listen(android.net.wifi.p2p.WifiP2pManager$Channel c, boolean enable, android.net.wifi.p2p.WifiP2pManager$ActionListener listener)
checkChannel(c);
c.mAsyncChannel.sendMessage(enable ? START_LISTEN : STOP_LISTEN,
0, c.putListener(listener));
| public void | removeGroup(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.p2p.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 {@link ActionListener#onSuccess} or
{@link ActionListener#onFailure}.
checkChannel(c);
c.mAsyncChannel.sendMessage(REMOVE_GROUP, 0, c.putListener(listener));
| public void | removeLocalService(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.p2p.nsd.WifiP2pServiceInfo servInfo, android.net.wifi.p2p.WifiP2pManager$ActionListener listener)Remove a registered local service added with {@link #addLocalService}
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 {@link ActionListener#onSuccess} or
{@link ActionListener#onFailure}.
checkChannel(c);
checkServiceInfo(servInfo);
c.mAsyncChannel.sendMessage(REMOVE_LOCAL_SERVICE, 0, c.putListener(listener), servInfo);
| public void | removeServiceRequest(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.p2p.nsd.WifiP2pServiceRequest req, android.net.wifi.p2p.WifiP2pManager$ActionListener listener)Remove a specified service discovery request added with {@link #addServiceRequest}
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 {@link ActionListener#onSuccess} or
{@link ActionListener#onFailure}.
checkChannel(c);
checkServiceRequest(req);
c.mAsyncChannel.sendMessage(REMOVE_SERVICE_REQUEST, 0,
c.putListener(listener), req);
| public void | requestConnectionInfo(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.p2p.WifiP2pManager$ConnectionInfoListener listener)Request device connection info.
checkChannel(c);
c.mAsyncChannel.sendMessage(REQUEST_CONNECTION_INFO, 0, c.putListener(listener));
| public void | requestGroupInfo(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.p2p.WifiP2pManager$GroupInfoListener listener)Request p2p group info.
checkChannel(c);
c.mAsyncChannel.sendMessage(REQUEST_GROUP_INFO, 0, c.putListener(listener));
| public void | requestPeers(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.p2p.WifiP2pManager$PeerListListener listener)Request the current list of peers.
checkChannel(c);
c.mAsyncChannel.sendMessage(REQUEST_PEERS, 0, c.putListener(listener));
| public void | requestPersistentGroupInfo(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.p2p.WifiP2pManager$PersistentGroupInfoListener listener)Request a list of all the persistent p2p groups stored in system.
checkChannel(c);
c.mAsyncChannel.sendMessage(REQUEST_PERSISTENT_GROUP_INFO, 0, c.putListener(listener));
| public void | responderReportNfcHandover(android.net.wifi.p2p.WifiP2pManager$Channel c, java.lang.String handoverRequest, android.net.wifi.p2p.WifiP2pManager$ActionListener listener)
checkChannel(c);
Bundle bundle = new Bundle();
bundle.putString(EXTRA_HANDOVER_MESSAGE, handoverRequest);
c.mAsyncChannel.sendMessage(RESPONDER_REPORT_NFC_HANDOVER, 0,
c.putListener(listener), bundle);
| public void | setDeviceName(android.net.wifi.p2p.WifiP2pManager$Channel c, java.lang.String devName, android.net.wifi.p2p.WifiP2pManager$ActionListener listener)Set p2p device name.
checkChannel(c);
WifiP2pDevice d = new WifiP2pDevice();
d.deviceName = devName;
c.mAsyncChannel.sendMessage(SET_DEVICE_NAME, 0, c.putListener(listener), d);
| public void | setDnsSdResponseListeners(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.p2p.WifiP2pManager$DnsSdServiceResponseListener servListener, android.net.wifi.p2p.WifiP2pManager$DnsSdTxtRecordListener txtListener)Register a callback to be invoked on receiving Bonjour service discovery
response.
see {@link #discoverServices} for the detail.
checkChannel(c);
c.mDnsSdServRspListener = servListener;
c.mDnsSdTxtListener = txtListener;
| public void | setMiracastMode(int mode)Internal use only @hide
try {
mService.setMiracastMode(mode);
} catch(RemoteException e) {
// ignore
}
| public void | setServiceResponseListener(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.p2p.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
{@link #setDnsSdResponseListeners} or {@link #setUpnpServiceResponseListener}
respectively.
see {@link #discoverServices} for the detail.
checkChannel(c);
c.mServRspListener = listener;
| public void | setUpnpServiceResponseListener(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.p2p.WifiP2pManager$UpnpServiceResponseListener listener)Register a callback to be invoked on receiving upnp service discovery
response.
see {@link #discoverServices} for the detail.
checkChannel(c);
c.mUpnpServRspListener = listener;
| public void | setWFDInfo(android.net.wifi.p2p.WifiP2pManager$Channel c, WifiP2pWfdInfo wfdInfo, android.net.wifi.p2p.WifiP2pManager$ActionListener listener)
checkChannel(c);
c.mAsyncChannel.sendMessage(SET_WFD_INFO, 0, c.putListener(listener), wfdInfo);
| public void | setWifiP2pChannels(android.net.wifi.p2p.WifiP2pManager$Channel c, int lc, int oc, android.net.wifi.p2p.WifiP2pManager$ActionListener listener)
checkChannel(c);
Bundle p2pChannels = new Bundle();
p2pChannels.putInt("lc", lc);
p2pChannels.putInt("oc", oc);
c.mAsyncChannel.sendMessage(SET_CHANNEL, 0, c.putListener(listener), p2pChannels);
| public void | startWps(android.net.wifi.p2p.WifiP2pManager$Channel c, android.net.wifi.WpsInfo wps, android.net.wifi.p2p.WifiP2pManager$ActionListener listener)Start a Wi-Fi Protected Setup (WPS) session.
The function call immediately returns after sending a request to start a
WPS session. Currently, this is only valid if the current device is running
as a group owner to allow any new clients to join the group. The application
is notified of a success or failure to initiate WPS through listener callbacks
{@link ActionListener#onSuccess} or {@link ActionListener#onFailure}.
checkChannel(c);
c.mAsyncChannel.sendMessage(START_WPS, 0, c.putListener(listener), wps);
| public void | stopPeerDiscovery(android.net.wifi.p2p.WifiP2pManager$Channel c, 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. The application is notified of a success or failure to initiate
stop through listener callbacks {@link ActionListener#onSuccess} or
{@link ActionListener#onFailure}.
checkChannel(c);
c.mAsyncChannel.sendMessage(STOP_DISCOVERY, 0, c.putListener(listener));
|
|