public interface RangingListener
Known subtypesRangingAdapter
Receives everything a RangingSession has to say. Every method is called
on the EDT.
Most apps only care about updated; extend RangingAdapter rather than
implementing the whole interface.
Methods
public abstract void updated(RangingUpdate update) | A fresh measurement arrived. |
public abstract void peerRemoved(RangingRemovalReason reason) | The peer stopped being ranged. |
public abstract void suspended() | The platform paused the session – typically because the app went to the background without the entitlement that would let it keep ranging. |
public abstract void resumed() | A suspended session started running again. |
public abstract void invalidated(NearbyException error) | The session died and cannot be restarted. |
Method details
updated
public abstract void updated(RangingUpdate update)A fresh measurement arrived. Expect these several times a second
while the peer is in range, and expect individual fields to drop in
and out – see
RangingUpdate.Parameters
updateRangingUpdate- the measurement
peerRemoved
public abstract void peerRemoved(RangingRemovalReason reason)The peer stopped being ranged. The session stays alive and will
resume delivering updates if the peer comes back, so this is a cue
to gray the UI out rather than to tear it down.
Parameters
reasonRangingRemovalReason- why the peer went away
suspended
public abstract void suspended()The platform paused the session – typically because the app went to
the background without the entitlement that would let it keep
ranging. No updates arrive until
resumed fires.resumed
public abstract void resumed()A suspended session started running again.
invalidated
public abstract void invalidated(NearbyException error)The session died and cannot be restarted. Any further call on it
fails; prepare a new session if the feature is still wanted.
Parameters
errorNearbyException- why the session ended