public abstract class

AbstractThreadedSyncAdapter

extends Object
java.lang.Object
   ↳ android.content.AbstractThreadedSyncAdapter

Class Overview

An abstract implementation of a SyncAdapter that spawns a thread to invoke a sync operation. If a sync operation is already in progress when a startSync() request is received then an error will be returned to the new request and the existing request will be allowed to continue. When a startSync() is received and there is no sync operation in progress then a thread will be started to run the operation and onPerformSync(Account, Bundle, String, ContentProviderClient, SyncResult) will be invoked on that thread. If a cancelSync() is received that matches an existing sync operation then the thread that is running that sync operation will be interrupted, which will indicate to the thread that the sync has been canceled.

Summary

Constants
int LOG_SYNC_DETAILS This constant is deprecated. Private constant. May go away in the next release.
Public Constructors
AbstractThreadedSyncAdapter(Context context, boolean autoInitialize)
Public Methods
Context getContext()
final IBinder getSyncAdapterBinder()
abstract void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult)
Perform a sync for this account.
void onSyncCanceled()
Indicates that a sync operation has been canceled.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int LOG_SYNC_DETAILS

Since: API Level 5

This constant is deprecated.
Private constant. May go away in the next release.

Kernel event log tag. Also listed in data/etc/event-log-tags.

Constant Value: 2743 (0x00000ab7)

Public Constructors

public AbstractThreadedSyncAdapter (Context context, boolean autoInitialize)

Since: API Level 5
Parameters
context the Context that this is running within.
autoInitialize if true then sync requests that have SYNC_EXTRAS_INITIALIZE set will be internally handled by AbstractThreadedSyncAdapter by calling setIsSyncable(android.accounts.Account, String, int) with 1 if it is currently set to <0.

Public Methods

public Context getContext ()

Since: API Level 5

public final IBinder getSyncAdapterBinder ()

Since: API Level 5

Returns
  • a reference to the IBinder of the SyncAdapter service.

public abstract void onPerformSync (Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult)

Since: API Level 5

Perform a sync for this account. SyncAdapter-specific parameters may be specified in extras, which is guaranteed to not be null. Invocations of this method are guaranteed to be serialized.

Parameters
account the account that should be synced
extras SyncAdapter-specific parameters
authority the authority of this sync request
provider a ContentProviderClient that points to the ContentProvider for this authority
syncResult SyncAdapter-specific parameters

public void onSyncCanceled ()

Since: API Level 8

Indicates that a sync operation has been canceled. This will be invoked on a separate thread than the sync thread and so you must consider the multi-threaded implications of the work that you do in this method.