Package io.objectbox.sync.listener
Class AbstractSyncListener
java.lang.Object
io.objectbox.sync.listener.AbstractSyncListener
- All Implemented Interfaces:
SyncChangeListener
,SyncCompletedListener
,SyncConnectionListener
,SyncListener
,SyncLoginListener
,SyncTimeListener
A
SyncListener
with empty implementations of all interface methods.
This is helpful if you only want to override some methods.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Called when the client is disconnected from the sync server, e.g.void
Called on a successful login.void
onLoginFailed
(long syncLoginCode) Called on a login failure.void
onServerTimeUpdate
(long serverTimeNanos) Called when server time information is received on the client.void
onSyncChanges
(SyncChange[] syncChanges) Called each time when data from sync was applied locally.void
Called each time a sync was "completed", in the sense that the client caught up with the current server state.
-
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 interfaceSyncLoginListener
-
onLoginFailed
public void onLoginFailed(long syncLoginCode) Description copied from interface:SyncLoginListener
Called on a login failure. One ofSyncLoginCodes
, but neverSyncLoginCodes.OK
.- Specified by:
onLoginFailed
in interfaceSyncLoginListener
-
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 interfaceSyncCompletedListener
-
onSyncChanges
Description copied from interface:SyncChangeListener
Called each time when data from sync was applied locally.- Specified by:
onSyncChanges
in 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:SyncTimeListener
Called when server time information is received on the client.- Specified by:
onServerTimeUpdate
in interfaceSyncTimeListener
-
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 interfaceSyncConnectionListener
-