Interface RangingListener
- All Known Implementing Classes:
RangingAdapter
public interface RangingListener
Receives everything a RangingSession has to say. Every method is called
on the EDT.
Most apps only care about updated(RangingUpdate); extend RangingAdapter rather than
implementing the whole interface.
-
Method Summary
Modifier and TypeMethodDescriptionvoidinvalidated(NearbyException error) The session died and cannot be restarted.voidpeerRemoved(RangingRemovalReason reason) The peer stopped being ranged.voidresumed()A suspended session started running again.voidThe platform paused the session -- typically because the app went to the background without the entitlement that would let it keep ranging.voidupdated(RangingUpdate update) A fresh measurement arrived.
-
Method Details
-
updated
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
update: the measurement
-
peerRemoved
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
reason: why the peer went away
-
suspended
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 untilresumed()fires. -
resumed
void resumed()A suspended session started running again. -
invalidated
The session died and cannot be restarted. Any further call on it fails; prepare a new session if the feature is still wanted.
Parameters
error: why the session ended
-