Added in API level 26

IdentityChangedListener

open class IdentityChangedListener
kotlin.Any
   ↳ android.net.wifi.aware.IdentityChangedListener

Base class for Aware identity/cluster changes callbacks. Should be extended by applications and set when calling WifiAwareManager#attach(AttachCallback, IdentityChangedListener,. These are callbacks applying to the Aware connection as a whole - not to specific publish or subscribe sessions - for that see DiscoverySessionCallback.

Summary

Constants
static Int

Wi-Fi Aware cluster change event type when joining a cluster.

static Int

Wi-Fi Aware cluster change event type when starting a cluster.

Public constructors

Public methods
open Unit
onClusterIdChanged(clusterEventType: Int, clusterId: MacAddress)

Cluster ID changes could be trigger by either cluster started event or cluster joined event.

open Unit

Identity change may be due to device joining a cluster, starting a cluster, or discovery interface change (addresses are randomized at regular intervals).

Constants

CLUSTER_CHANGE_EVENT_JOINED

Added in API level 34
static val CLUSTER_CHANGE_EVENT_JOINED: Int

Wi-Fi Aware cluster change event type when joining a cluster.

Value: 1

CLUSTER_CHANGE_EVENT_STARTED

Added in API level 34
static val CLUSTER_CHANGE_EVENT_STARTED: Int

Wi-Fi Aware cluster change event type when starting a cluster.

Value: 0

Public constructors

IdentityChangedListener

Added in API level 26
IdentityChangedListener()

Public methods

onClusterIdChanged

Added in API level 34
open fun onClusterIdChanged(
    clusterEventType: Int,
    clusterId: MacAddress
): Unit

Cluster ID changes could be trigger by either cluster started event or cluster joined event.

Parameters
clusterEventType Int: The type of events that triggered the change of the cluster ID. Value is android.net.wifi.aware.IdentityChangedListener#CLUSTER_CHANGE_EVENT_STARTED, or android.net.wifi.aware.IdentityChangedListener#CLUSTER_CHANGE_EVENT_JOINED
clusterId MacAddress: The cluster id that the device just joined. This value cannot be null.

onIdentityChanged

Added in API level 26
open fun onIdentityChanged(mac: ByteArray!): Unit

Identity change may be due to device joining a cluster, starting a cluster, or discovery interface change (addresses are randomized at regular intervals). The implication is that peers you've been communicating with may no longer recognize you and you need to re-establish your identity - e.g. by starting a discovery session.

Parameters
mac ByteArray!: The MAC address of the Aware discovery interface. The application must have the android.Manifest.permission#ACCESS_FINE_LOCATION to get the actual MAC address, otherwise all 0's will be provided.