public abstract class ReplicationService extends android.app.Service implements ReplicationPolicyManager.ReplicationsCompletedListener
Service
so that they can properly manage the
lifecycle and handle being killed or restarted by the operating systemModifier and Type | Class and Description |
---|---|
class |
ReplicationService.LocalBinder |
static interface |
ReplicationService.ReplicationCompleteListener |
static class |
ReplicationService.SimpleReplicationCompleteListener
A simple
ReplicationService.ReplicationCompleteListener
to save clients having to override every method if they are only interested in a subset of
the events. |
Modifier and Type | Field and Description |
---|---|
static int |
COMMAND_NONE |
static int |
COMMAND_START_REPLICATION |
static int |
COMMAND_STOP_REPLICATION |
static java.lang.String |
EXTRA_COMMAND |
static java.lang.String |
EXTRA_INTENT |
START_CONTINUATION_MASK, START_FLAG_REDELIVERY, START_FLAG_RETRY, START_NOT_STICKY, START_REDELIVER_INTENT, START_STICKY, START_STICKY_COMPATIBILITY
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, AUDIO_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, DEVICE_POLICY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, INPUT_METHOD_SERVICE, KEYGUARD_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MODE_APPEND, MODE_MULTI_PROCESS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NFC_SERVICE, NOTIFICATION_SERVICE, POWER_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, STORAGE_SERVICE, TELEPHONY_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, UI_MODE_SERVICE, USB_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
Constructor and Description |
---|
ReplicationService() |
Modifier and Type | Method and Description |
---|---|
void |
addListener(ReplicationService.ReplicationCompleteListener listener)
Add a listener to the set of
ReplicationService.ReplicationCompleteListener s that are notified when
replications complete. |
void |
allReplicationsCompleted() |
android.os.IBinder |
onBind(android.content.Intent intent) |
void |
onCreate() |
void |
onRebind(android.content.Intent intent) |
int |
onStartCommand(android.content.Intent intent,
int flags,
int startId) |
boolean |
onUnbind(android.content.Intent intent) |
void |
removeListener(ReplicationService.ReplicationCompleteListener listener)
Remove a listener from the set of
ReplicationService.ReplicationCompleteListener s that are notified when
replications complete. |
void |
replicationCompleted(int id) |
void |
replicationErrored(int id) |
void |
setOperationStartedListener(com.cloudant.sync.replication.ReplicationService.OperationStartedListener listener)
Set a listener to be notified when an operation has started.
|
void |
setReplicationPolicyManager(ReplicationPolicyManager replicationPolicyManager)
Set the
ReplicationPolicyManager to be used by this ReplicationService. |
void |
setReplicators(Replicator[] replicators)
Set the
Replicator objects configured to perform the required replications. |
getApplication, onConfigurationChanged, onDestroy, onLowMemory, onStart, onTaskRemoved, onTrimMemory, startForeground, stopForeground, stopSelf, stopSelf, stopSelfResult
bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkUriPermission, checkUriPermission, clearWallpaper, createPackageContext, databaseList, deleteDatabase, deleteFile, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getCacheDir, getClassLoader, getContentResolver, getDatabasePath, getDir, getExternalCacheDir, getExternalFilesDir, getFilesDir, getFileStreamPath, getMainLooper, getObbDir, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getSystemService, getTheme, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isRestricted, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, removeStickyBroadcast, revokeUriPermission, sendBroadcast, sendBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendStickyBroadcast, sendStickyOrderedBroadcast, setTheme, setWallpaper, setWallpaper, startActivities, startActivity, startInstrumentation, startIntentSender, startService, stopService, unbindService, unregisterReceiver
public static final java.lang.String EXTRA_INTENT
public static final java.lang.String EXTRA_COMMAND
public static final int COMMAND_NONE
public static final int COMMAND_START_REPLICATION
public static final int COMMAND_STOP_REPLICATION
public void onCreate()
onCreate
in class android.app.Service
public void setReplicators(Replicator[] replicators)
Replicator
objects configured to perform the required replications.
The ReplicationService
will not begin replications until this method has
been called. This operation should only be called once.replicators
- An array of the configured Replicator
objects.java.lang.IllegalArgumentException
- if replicators
is null or empty.java.lang.IllegalStateException
- if called again after a previous call to this method
with a valid array of Replicator
objects.public int onStartCommand(android.content.Intent intent, int flags, int startId)
onStartCommand
in class android.app.Service
public android.os.IBinder onBind(android.content.Intent intent)
onBind
in class android.app.Service
public boolean onUnbind(android.content.Intent intent)
onUnbind
in class android.app.Service
public void onRebind(android.content.Intent intent)
onRebind
in class android.app.Service
public void setReplicationPolicyManager(ReplicationPolicyManager replicationPolicyManager)
ReplicationPolicyManager
to be used by this ReplicationService.replicationPolicyManager
- public void allReplicationsCompleted()
allReplicationsCompleted
in interface ReplicationPolicyManager.ReplicationsCompletedListener
public void replicationCompleted(int id)
replicationCompleted
in interface ReplicationPolicyManager.ReplicationsCompletedListener
public void replicationErrored(int id)
replicationErrored
in interface ReplicationPolicyManager.ReplicationsCompletedListener
public void addListener(ReplicationService.ReplicationCompleteListener listener)
ReplicationService.ReplicationCompleteListener
s that are notified when
replications complete.listener
- The listener to add.public void removeListener(ReplicationService.ReplicationCompleteListener listener)
ReplicationService.ReplicationCompleteListener
s that are notified when
replications complete.listener
- The listener to remove.public void setOperationStartedListener(com.cloudant.sync.replication.ReplicationService.OperationStartedListener listener)
listener
- The listener to add