Class AbstractSyncListener

java.lang.Object
io.objectbox.sync.listener.AbstractSyncListener
All Implemented Interfaces:
SyncChangeListener, SyncCompletedListener, SyncConnectionListener, SyncListener, SyncLoginListener, SyncTimeListener

@Experimental public abstract class AbstractSyncListener extends Object implements SyncListener
A SyncListener with empty implementations of all interface methods. This is helpful if you only want to override some methods.
  • Constructor Details

    • AbstractSyncListener

      public AbstractSyncListener()
  • Method Details

    • onLoggedIn

      public void onLoggedIn()
      Description copied from interface: SyncLoginListener
      Called on a successful login.

      At this point the connection to the sync destination was established and entered an operational state, in which data can be sent both ways.

      Specified by:
      onLoggedIn in interface SyncLoginListener
    • onLoginFailed

      public void onLoginFailed(long syncLoginCode)
      Description copied from interface: SyncLoginListener
      Called on a login failure. One of SyncLoginCodes, but never SyncLoginCodes.OK.
      Specified by:
      onLoginFailed in interface SyncLoginListener
    • onUpdatesCompleted

      public void onUpdatesCompleted()
      Description copied from interface: SyncCompletedListener
      Called each time a sync was "completed", in the sense that the client caught up with the current server state. The client is "up-to-date".
      Specified by:
      onUpdatesCompleted in interface SyncCompletedListener
    • onSyncChanges

      public void onSyncChanges(SyncChange[] syncChanges)
      Description copied from interface: SyncChangeListener
      Called each time when data from sync was applied locally.
      Specified by:
      onSyncChanges in interface SyncChangeListener
      Parameters:
      syncChanges - This contains the entity type (schema) ID, the removed IDs and the put IDs for that entity.
    • onServerTimeUpdate

      public void onServerTimeUpdate(long serverTimeNanos)
      Description copied from interface: SyncTimeListener
      Called when server time information is received on the client.
      Specified by:
      onServerTimeUpdate in interface SyncTimeListener
    • onDisconnected

      public void onDisconnected()
      Description copied from interface: SyncConnectionListener
      Called when the client is disconnected from the sync server, e.g. due to a network error.

      Depending on the configuration, the sync client typically tries to reconnect automatically, triggering a SyncLoginListener again.

      Specified by:
      onDisconnected in interface SyncConnectionListener