| java.lang.Object | |||||
| ↳ | android.content.Context | ||||
| ↳ | android.content.ContextWrapper | ||||
| ↳ | android.app.Service | ||||
| ↳ | android.app.IntentService | ||||
| ↳ | com.google.android.gms.cloudsave.BaseEventService | ||||
Base implementation of Service for listening to CloudSave events. The implementation of this service needs to be registered in application’s manifest as follows
<manifest ...>
<application ...>
<service android:name=<YOUR_SERVICE>
android:permission="com.google.android.gms.cloudsave.EVENT_BROADCAST" >
<intent-filter>
<action android:name="com.google.android.gms.cloudsave.EVENT" />
</intent-filter>
...
</application>
</manifest>
Permission "com.google.android.gms.cloudsave.EVENT_BROADCAST" makes sure that the service will only
listen to events sent by CloudSave. This protects the app from other malicious apps that might want
to inject events.
|
[Expand]
Inherited Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.app.Service
| |||||||||||
From class
android.content.Context
| |||||||||||
From interface
android.content.ComponentCallbacks2
| |||||||||||
| Protected Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Signals the CloudSave service to apply the current set of remote changes.
| |||||||||||
This method is called when there is a conflict between the local version of a given
Entity and remote server version. | |||||||||||
Notifies about CloudSave errors that happen when performing async background tasks like background
syncing.
| |||||||||||
This method is called when a change in App's data is found on the remote server.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.app.IntentService
| |||||||||||
From class
android.app.Service
| |||||||||||
From class
android.content.ContextWrapper
| |||||||||||
From class
android.content.Context
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
android.content.ComponentCallbacks
| |||||||||||
From interface
android.content.ComponentCallbacks2
| |||||||||||
Signals the CloudSave service to apply the current set of remote changes. The remote changes do not
get merged into local db till this method is called. This method is called by the default
implementation of onRemoteChanged() already and hence does not need to be called by the
App explicitly unless the onRemoteChanged() is being overridden.
See onRemoteChanged(List, String) for more details.
| context | String context provided by onRemoteChanged(List, String) |
|---|
Status result specifying if the call was successful or not
This method is called when there is a conflict between the local version of a given
Entity and remote server version. It allows the application to do a three way
merge for the given conflict.
| localEntity | represents the current view of the Entity in local database. |
|---|---|
| baseEntity | represents the last common view of the Entity between local db and server. This is the nearest common ancestor of localEntity and remoteEntity. |
| remoteEntity | represents the current view of the Entity on remote server. |
Entity representing a consistent merger of localEntity and remoteEntity.
Notifies about CloudSave errors that happen when performing async background tasks like background syncing.
| errorCode | integer error code based on the type of error |
|---|---|
| desc | a human readable description of the error |
This method is called when a change in App's data is found on the remote server. The default
implementation invokes applyRemoteChanges(String) to apply these changes. Overriding
this method allows an app to
1) Intercept the event and update UI or clean up data that the app may be storing locally.
In this case the overridden method must call super() to make sure that the remote changes
are applied to the local database.
2) Delay application of the remote changes. In this case don't call super() from the
overridden method. In this case, the burden of making sure that
applyRemoteChanges(String) is called rests on the App's shoulder. Extreme care
needs to be taken in this case as bad handling of this can end up stopping the App from
syncing with remote server.
Note: The remote changes do not get merged into local db till
applyRemoteChanges(String) is called. If the remote changes are not applied then all
remote syncs henceforth will invoke this event and a new remote sync will not happen till
the previous changes are applied.
| entityKeys | Entity.Key for the Entities that have changed. |
|---|---|
| context | for this set of changes. This is used by applyRemoteChanges(String)
|