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

Called when this device details have changed.

open Unit

Called when peer discovery has either started or stopped.

open Unit

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

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

Called when peer listen has either started or stopped.

open Unit

Called when Wi-Fi p2p has been enabled or disabled.

open Unit

Called to indicate group owner that a group client has disconnected.

open Unit

Called to indicate group owner that a group client has joined p2p group successfully.

open Unit

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, or android.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.

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, or android.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, or android.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.