Package io.objectbox.sync.listener
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 java.lang.Object implements SyncListener
ASyncListenerwith empty implementations of all interface methods. This is helpful if you only want to override some methods.
-
-
Constructor Summary
Constructors Constructor Description AbstractSyncListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonDisconnected()Called when the client is disconnected from the sync server, e.g.voidonLoggedIn()Called on a successful login.voidonLoginFailed(long syncLoginCode)Called on a login failure.voidonServerTimeUpdate(long serverTimeNanos)Called when server time information is received on the client.voidonSyncChanges(SyncChange[] syncChanges)Called each time when data from sync was applied locally.voidonUpdatesCompleted()Called each time a sync was "completed", in the sense that the client caught up with the current server state.
-
-
-
Method Detail
-
onLoggedIn
public void onLoggedIn()
Description copied from interface:SyncLoginListenerCalled 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:
onLoggedInin interfaceSyncLoginListener
-
onLoginFailed
public void onLoginFailed(long syncLoginCode)
Description copied from interface:SyncLoginListenerCalled on a login failure. One ofSyncLoginCodes, but neverSyncLoginCodes.OK.- Specified by:
onLoginFailedin interfaceSyncLoginListener
-
onUpdatesCompleted
public void onUpdatesCompleted()
Description copied from interface:SyncCompletedListenerCalled 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:
onUpdatesCompletedin interfaceSyncCompletedListener
-
onSyncChanges
public void onSyncChanges(SyncChange[] syncChanges)
Description copied from interface:SyncChangeListenerCalled each time when data from sync was applied locally.- Specified by:
onSyncChangesin interfaceSyncChangeListener- 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:SyncTimeListenerCalled when server time information is received on the client.- Specified by:
onServerTimeUpdatein interfaceSyncTimeListener
-
onDisconnected
public void onDisconnected()
Description copied from interface:SyncConnectionListenerCalled 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
SyncLoginListeneragain.- Specified by:
onDisconnectedin interfaceSyncConnectionListener
-
-