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 Type
    Method
    Description
    void
    The session died and cannot be restarted.
    void
    The peer stopped being ranged.
    void
    A suspended session started running again.
    void
    The platform paused the session -- typically because the app went to the background without the entitlement that would let it keep ranging.
    void
    A fresh measurement arrived.
  • Method Details

    • updated

      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
      • update: the measurement
    • peerRemoved

      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
      • 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 until resumed() fires.
    • resumed

      void resumed()
      A suspended session started running again.
    • invalidated

      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
      • error: why the session ended