Methods Summary |
---|
public void | cancelSync()
if (mSyncThread != null) {
mSyncThread.cancelSync();
}
|
protected java.lang.Object | createSyncInfo()
return null;
|
public final Context | getContext()Retrieve the Context this adapter is running in. Only available
once onSyncStarting() is called (not available from constructor).
return mContext;
|
public abstract void | getServerDiffs(SyncContext context, android.content.TempProviderSyncAdapter$SyncData syncData, SyncableContentProvider tempProvider, android.os.Bundle extras, java.lang.Object syncInfo, SyncResult syncResult)Get diffs from the server since the last completed sync and put them
into a temporary provider.
|
protected boolean | hasTooManyDeletions(SyncStats stats)
long numEntries = stats.numEntries;
long numDeletedEntries = stats.numDeletes;
long percentDeleted = (numDeletedEntries == 0)
? 0
: (100 * numDeletedEntries /
(numEntries + numDeletedEntries));
boolean tooManyDeletions =
(numDeletedEntries > NUM_ALLOWED_SIMULTANEOUS_DELETIONS)
&& (percentDeleted > PERCENT_ALLOWED_SIMULTANEOUS_DELETIONS);
return tooManyDeletions;
|
protected void | initTempProvider(SyncableContentProvider cp)Initializes the temporary content providers used during
{@link TempProviderSyncAdapter#sendClientDiffs}.
May copy relevant data from the underlying db into this provider so
joins, etc., can work.
|
public abstract boolean | isReadOnly()Implement this to return true if the data in your content provider
is read only.
|
protected void | logSyncDetails(long bytesSent, long bytesReceived, SyncResult result)Logs details on the sync.
Normally this will be overridden by a subclass that will provide
provider-specific details.
EventLog.writeEvent(SyncAdapter.LOG_SYNC_DETAILS, TAG, bytesSent, bytesReceived, "");
|
public android.content.TempProviderSyncAdapter$SyncData | newSyncData()Create and return a new, empty SyncData object
return null;
|
public abstract void | onAccountsChanged(java.lang.String[] accounts)Called when the accounts list possibly changed, to give the
SyncAdapter a chance to do any necessary bookkeeping, e.g.
to make sure that any required SubscribedFeeds subscriptions
exist.
|
public abstract void | onSyncCanceled()Indicate to the SyncAdapter that the last sync that was started has
been cancelled.
|
public abstract void | onSyncEnding(SyncContext context, boolean success)Called right after a sync is completed
|
public abstract void | onSyncStarting(SyncContext context, java.lang.String account, boolean forced, SyncResult result)Called right before a sync is started.
|
public android.content.TempProviderSyncAdapter$SyncData | readSyncData(SyncableContentProvider contentProvider)Reads the sync data from the ContentProvider
return null;
|
public abstract void | sendClientDiffs(SyncContext context, SyncableContentProvider clientDiffs, SyncableContentProvider serverDiffs, SyncResult syncResult, boolean dontActuallySendDeletes)Send client diffs to the server, optionally receiving more diffs from the server
|
public final void | setContext(Context context)
mContext = context;
|
public void | startSync(SyncContext syncContext, java.lang.String account, android.os.Bundle extras)
if (mSyncThread != null) {
syncContext.onFinished(SyncResult.ALREADY_IN_PROGRESS);
return;
}
mSyncThread = new SyncThread(syncContext, account, extras);
mSyncThread.start();
|
public void | writeSyncData(android.content.TempProviderSyncAdapter$SyncData syncData, SyncableContentProvider contentProvider)Stores the sync data in the Sync Stats database, keying it by
the account that was set in the last call to onSyncStarting()
|