IdentityChangedListener


public class IdentityChangedListener
extends Object

java.lang.Object
   ↳ 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, android.os.Handler). These are callbacks applying to the Aware connection as a whole - not to specific publish or subscribe sessions - for that see DiscoverySessionCallback.

Summary

Constants

int CLUSTER_CHANGE_EVENT_JOINED

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

int CLUSTER_CHANGE_EVENT_STARTED

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

Public constructors

IdentityChangedListener()

Public methods

void onClusterIdChanged(int clusterEventType, MacAddress clusterId)

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

void onIdentityChanged(byte[] mac)

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

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Constants

CLUSTER_CHANGE_EVENT_JOINED

Added in API level 34
public static final int CLUSTER_CHANGE_EVENT_JOINED

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

Constant Value: 1 (0x00000001)

CLUSTER_CHANGE_EVENT_STARTED

Added in API level 34
public static final int CLUSTER_CHANGE_EVENT_STARTED

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

Constant Value: 0 (0x00000000)

Public constructors

IdentityChangedListener

Added in API level 26
public IdentityChangedListener ()

Public methods

onClusterIdChanged

Added in API level 34
public void onClusterIdChanged (int clusterEventType, 
                MacAddress clusterId)

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 CLUSTER_CHANGE_EVENT_STARTED, or 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
public void onIdentityChanged (byte[] mac)

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 byte: The MAC address of the Aware discovery interface. The application must have the Manifest.permission.ACCESS_FINE_LOCATION to get the actual MAC address, otherwise all 0's will be provided.