Interface ContinuityListener


public interface ContinuityListener

Notified when a state arrives from somewhere other than this device's own storage: one of the user's other devices handed off what they were doing, or a StateRelay produced something newer than what is here.

Registered with Continuity.addContinuationListener(ContinuityListener). Called on the event dispatch thread, and never for this device's own echo.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    A state arrived.
  • Method Details

    • stateReceived

      boolean stateReceived(AppState state)

      A state arrived. Return true to let the framework restore it, false to ignore it.

      Returning false is the hook for the decisions only the app can make -- that the user is midway through a payment and must not be moved, that the state is older than what is on screen, that it belongs to a different account than the one signed in here. A listener that returns false has consumed the state: nothing is restored and no other listener is asked.

      Doing the work yourself and returning false is a supported pattern, and is how an app prompts before jumping: keep the state, return false, and call Continuity.restore(AppState) when the user accepts.

      Parameters
      • state: the state that arrived
      Returns

      true to restore it now