Added in API level 33

ExternalApproverRequestListener


interface ExternalApproverRequestListener
android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener

Interface for callback invocation when an incoming request is received. This callback is registered by addExternalApprover(android.net.wifi.p2p.WifiP2pManager.Channel,android.net.MacAddress,android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener).

Summary

Constants
static Int

Detached since the WifiP2pManager channel was closed, e.

static Int

Detached due to a framework failure.

static Int

Detached by a call to removeExternalApprover(android.net.wifi.p2p.WifiP2pManager.Channel,android.net.MacAddress,android.net.wifi.p2p.WifiP2pManager.ActionListener).

static Int

Detached when a new approver replaces an old one.

static Int

This device received an invitation request from GO to join the group.

static Int

This GO device received a request from a peer to join the group.

static Int

This device received a negotiation request from another peer.

Public methods
abstract Unit
onAttached(deviceAddress: MacAddress)

Called when an approver registration via addExternalApprover(android.net.wifi.p2p.WifiP2pManager.Channel,android.net.MacAddress,android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener) is successful.

abstract Unit
onConnectionRequested(requestType: Int, config: WifiP2pConfig, device: WifiP2pDevice)

Called when there is an incoming connection request which matches a peer (identified by its MacAddress) registered by the external approver through addExternalApprover(android.net.wifi.p2p.WifiP2pManager.Channel,android.net.MacAddress,android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener).

abstract Unit
onDetached(deviceAddress: MacAddress, reason: Int)

Called when an approver registration via addExternalApprover(android.net.wifi.p2p.WifiP2pManager.Channel,android.net.MacAddress,android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener) has failed.

abstract Unit
onPinGenerated(deviceAddress: MacAddress, pin: String)

Called when a PIN is generated by the WiFi service.

Constants

APPROVER_DETACH_REASON_CLOSE

Added in API level 33
static val APPROVER_DETACH_REASON_CLOSE: Int

Detached since the WifiP2pManager channel was closed, e.g. by using Channel#close() method. Used in onDetached(android.net.MacAddress,int).

Value: 3

APPROVER_DETACH_REASON_FAILURE

Added in API level 33
static val APPROVER_DETACH_REASON_FAILURE: Int

Detached due to a framework failure. Used in onDetached(android.net.MacAddress,int).

Value: 1

APPROVER_DETACH_REASON_REPLACE

Added in API level 33
static val APPROVER_DETACH_REASON_REPLACE: Int

Detached when a new approver replaces an old one. Used in onDetached(android.net.MacAddress,int).

Value: 2

REQUEST_TYPE_INVITATION

Added in API level 33
static val REQUEST_TYPE_INVITATION: Int

This device received an invitation request from GO to join the group. Used in onConnectionRequested(int,android.net.wifi.p2p.WifiP2pConfig,android.net.wifi.p2p.WifiP2pDevice).

Value: 1

REQUEST_TYPE_JOIN

Added in API level 33
static val REQUEST_TYPE_JOIN: Int

This GO device received a request from a peer to join the group. Used in onConnectionRequested(int,android.net.wifi.p2p.WifiP2pConfig,android.net.wifi.p2p.WifiP2pDevice).

Value: 2

REQUEST_TYPE_NEGOTIATION

Added in API level 33
static val REQUEST_TYPE_NEGOTIATION: Int

This device received a negotiation request from another peer. Used in onConnectionRequested(int,android.net.wifi.p2p.WifiP2pConfig,android.net.wifi.p2p.WifiP2pDevice).

Value: 0

Public methods

onAttached

Added in API level 33
abstract fun onAttached(deviceAddress: MacAddress): Unit

Called when an approver registration via addExternalApprover(android.net.wifi.p2p.WifiP2pManager.Channel,android.net.MacAddress,android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener) is successful.

Parameters
deviceAddress MacAddress: is the peer MAC address used in the registration. This value cannot be null.

onConnectionRequested

Added in API level 33
abstract fun onConnectionRequested(
    requestType: Int,
    config: WifiP2pConfig,
    device: WifiP2pDevice
): Unit

Called when there is an incoming connection request which matches a peer (identified by its MacAddress) registered by the external approver through addExternalApprover(android.net.wifi.p2p.WifiP2pManager.Channel,android.net.MacAddress,android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener). The external approver is expected to follow up with a connection decision using the setConnectionRequestResult(android.net.wifi.p2p.WifiP2pManager.Channel,android.net.MacAddress,int,android.net.wifi.p2p.WifiP2pManager.ActionListener) with CONNECTION_REQUEST_ACCEPT, CONNECTION_REQUEST_REJECT, or CONNECTION_REQUEST_DEFER_TO_SERVICE.

Parameters
requestType Int: is one of REQUEST_TYPE_NEGOTIATION, REQUEST_TYPE_INVITATION, and REQUEST_TYPE_JOIN. Value is android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener#REQUEST_TYPE_NEGOTIATION, android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener#REQUEST_TYPE_INVITATION, or android.net.wifi.p2p.WifiP2pManager.ExternalApproverRequestListener#REQUEST_TYPE_JOIN
config WifiP2pConfig: is the peer configuration. This value cannot be null.
device WifiP2pDevice: is the peer information. This value cannot be null.

onPinGenerated

Added in API level 33
abstract fun onPinGenerated(
    deviceAddress: MacAddress,
    pin: String
): Unit

Called when a PIN is generated by the WiFi service. The external approver can display the PIN, exchange the PIN via Out-Of-Band way or ask the wifi service to show the PIN as usual using the setConnectionRequestResult(android.net.wifi.p2p.WifiP2pManager.Channel,android.net.MacAddress,int,android.net.wifi.p2p.WifiP2pManager.ActionListener) with CONNECTION_REQUEST_DEFER_SHOW_PIN_TO_SERVICE.

Parameters
deviceAddress MacAddress: is the peer MAC address used in the registration. This value cannot be null.
pin String: is the WPS PIN. This value cannot be null.