public interface PresenceListener

Told when an associated device comes into or goes out of range. Both methods are called on the EDT.

Presence is the reason companion association is worth using for an accessory the app talks to regularly: the OS watches for the device and wakes the app, instead of the app burning battery on a scan it runs itself.

Methods

public abstract void deviceAppeared(CompanionDevice device)The associated device came into range.
public abstract void deviceDisappeared(CompanionDevice device)The associated device went out of range.

Method details

deviceAppeared

public abstract void deviceAppeared(CompanionDevice device)
The associated device came into range.

Parameters

device CompanionDevice
the device that appeared

deviceDisappeared

public abstract void deviceDisappeared(CompanionDevice device)
The associated device went out of range.

Parameters

device CompanionDevice
the device that disappeared