WifiP2pListener
interface WifiP2pListener
| 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.
Summary
| Public methods | |
|---|---|
| open Unit | onDeviceConfigurationChanged(p2pDevice: WifiP2pDevice?)Called when this device details have changed. | 
| open Unit | onDiscoveryStateChanged(state: Int)Called when peer discovery has either started or stopped. | 
| open Unit | onFrequencyChanged(p2pInfo: WifiP2pInfo, p2pGroup: WifiP2pGroup)Called when the frequency of a formed group has been changed. | 
| open Unit | onGroupCreated(p2pInfo: WifiP2pInfo, p2pGroup: WifiP2pGroup)Called when either group owner or group client has created p2p group successfully. | 
| open Unit | Called when either group owner or group client is creating p2p group. | 
| open Unit | onGroupCreationFailed(reason: Int)Called when group creation has failed. | 
| open Unit | Called when group negotiation has been rejected by user. | 
| open Unit | Called when p2p group has been removed. | 
| open Unit | onListenStateChanged(state: Int)Called when peer listen has either started or stopped. | 
| open Unit | onP2pStateChanged(state: Int)Called when Wi-Fi p2p has been enabled or disabled. | 
| open Unit | onPeerClientDisconnected(p2pInfo: WifiP2pInfo, p2pGroup: WifiP2pGroup)Called to indicate group owner that a group client has disconnected. | 
| open Unit | onPeerClientJoined(p2pInfo: WifiP2pInfo, p2pGroup: WifiP2pGroup)Called to indicate group owner that a group client has joined p2p group successfully. | 
| open Unit | onPeerListChanged(p2pDeviceList: WifiP2pDeviceList)Called when the available peer list has changed. | 
Public methods
onDeviceConfigurationChanged
open fun onDeviceConfigurationChanged(p2pDevice: WifiP2pDevice?): Unit
Called when this device details have changed.
| Parameters | |
|---|---|
| p2pDevice | WifiP2pDevice?: provides this device details. This value may be null. | 
onDiscoveryStateChanged
open fun onDiscoveryStateChanged(state: Int): Unit
Called when peer discovery has either started or stopped.
| Parameters | |
|---|---|
| state | Int: indicates whether discovery has started or stopped. Value is android.net.wifi.p2p.WifiP2pManager#WIFI_P2P_DISCOVERY_STOPPED, orandroid.net.wifi.p2p.WifiP2pManager#WIFI_P2P_DISCOVERY_STARTED | 
onFrequencyChanged
open fun onFrequencyChanged(
p2pInfo: WifiP2pInfo,
p2pGroup: WifiP2pGroup
): Unit
Called when the frequency of a formed group has been changed.
| Parameters | |
|---|---|
| p2pInfo | WifiP2pInfo: provides the p2p connection info. This value cannot be null. | 
| p2pGroup | WifiP2pGroup: provides the details of the group. This value cannot be null. | 
onGroupCreated
open fun onGroupCreated(
p2pInfo: WifiP2pInfo,
p2pGroup: WifiP2pGroup
): Unit
Called when either group owner or group client has created p2p group successfully.
| Parameters | |
|---|---|
| p2pInfo | WifiP2pInfo: provides the p2p connection info. This value cannot be null. | 
| p2pGroup | WifiP2pGroup: provides the details of the group. This value cannot be null. | 
onGroupCreating
open fun onGroupCreating(): Unit
Called when either group owner or group client is creating p2p group.
onGroupCreationFailed
open fun onGroupCreationFailed(reason: Int): Unit
Called when group creation has failed.
onGroupNegotiationRejectedByUser
open fun onGroupNegotiationRejectedByUser(): Unit
Called when group negotiation has been rejected by user.
onGroupRemoved
open fun onGroupRemoved(): Unit
Called when p2p group has been removed.
onListenStateChanged
open fun onListenStateChanged(state: Int): Unit
Called when peer listen has either started or stopped.
| Parameters | |
|---|---|
| state | Int: indicates whether listen has started or stopped. Value is android.net.wifi.p2p.WifiP2pManager#WIFI_P2P_LISTEN_STOPPED, orandroid.net.wifi.p2p.WifiP2pManager#WIFI_P2P_LISTEN_STARTED | 
onP2pStateChanged
open fun onP2pStateChanged(state: Int): Unit
Called when Wi-Fi p2p has been enabled or disabled.
| Parameters | |
|---|---|
| state | Int: indicates whether Wi-Fi p2p is enabled or disabled. Value is android.net.wifi.p2p.WifiP2pManager#WIFI_P2P_STATE_DISABLED, orandroid.net.wifi.p2p.WifiP2pManager#WIFI_P2P_STATE_ENABLED | 
onPeerClientDisconnected
open fun onPeerClientDisconnected(
p2pInfo: WifiP2pInfo,
p2pGroup: WifiP2pGroup
): Unit
Called to indicate group owner that a group client has disconnected.
| Parameters | |
|---|---|
| p2pInfo | WifiP2pInfo: provides the p2p connection info. This value cannot be null. | 
| p2pGroup | WifiP2pGroup: provides the details of the group. This value cannot be null. | 
onPeerClientJoined
open fun onPeerClientJoined(
p2pInfo: WifiP2pInfo,
p2pGroup: WifiP2pGroup
): Unit
Called to indicate group owner that a group client has joined p2p group successfully.
| Parameters | |
|---|---|
| p2pInfo | WifiP2pInfo: provides the p2p connection info. This value cannot be null. | 
| p2pGroup | WifiP2pGroup: provides the details of the group. This value cannot be null. | 
onPeerListChanged
open fun onPeerListChanged(p2pDeviceList: WifiP2pDeviceList): Unit
Called when the available peer list has changed. This can be sent as a result of peers being found, lost or updated.
| Parameters | |
|---|---|
| p2pDeviceList | WifiP2pDeviceList: provides the full list of current peers. This value cannot be null. | 
