Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.

IdentityChangedListener

public class IdentityChangedListener
extends Object

java.lang.Object
   ↳ android.net.wifi.aware.IdentityChangedListener


Base class for a listener which is called with the MAC address of the Aware interface whenever it is changed. 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. This actual MAC address of the interface may also be useful if the application uses alternative (non-Aware) discovery but needs to set up a Aware connection. The provided Aware discovery interface MAC address can then be used in WifiAwareSession.createNetworkSpecifierOpen(int, byte[]) or WifiAwareSession.createNetworkSpecifierPassphrase(int, byte[], String).

Summary

Public constructors

IdentityChangedListener()

Public methods

void onIdentityChanged(byte[] mac)

Inherited methods

Public constructors

IdentityChangedListener

added in API level 26
public IdentityChangedListener ()

Public methods

onIdentityChanged

added in API level 26
public void onIdentityChanged (byte[] mac)

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