|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.content.SyncAdapter
android.content.TempProviderSyncAdapter
public abstract class TempProviderSyncAdapter
| Nested Class Summary | |
|---|---|
static class |
TempProviderSyncAdapter.SyncData
Used by getServerDiffs() to track the sync progress for a given sync adapter. |
| Nested classes/interfaces inherited from class android.content.SyncAdapter |
|---|
SyncAdapter.Transport |
| Field Summary |
|---|
| Fields inherited from class android.content.SyncAdapter |
|---|
LOG_SYNC_DETAILS, mTransport |
| Constructor Summary | |
|---|---|
TempProviderSyncAdapter(SyncableContentProvider provider)
|
|
| Method Summary | |
|---|---|
void |
cancelSync()
Cancel the most recently initiated sync. |
protected Object |
createSyncInfo()
|
Context |
getContext()
Retrieve the Context this adapter is running in. |
abstract void |
getServerDiffs(SyncContext context,
TempProviderSyncAdapter.SyncData syncData,
SyncableContentProvider tempProvider,
Bundle extras,
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)
|
protected void |
initTempProvider(SyncableContentProvider cp)
Initializes the temporary content providers used during sendClientDiffs(android.content.SyncContext, android.content.SyncableContentProvider, android.content.SyncableContentProvider, android.content.SyncResult, boolean). |
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. |
TempProviderSyncAdapter.SyncData |
newSyncData()
Create and return a new, empty SyncData object |
abstract void |
onAccountsChanged(String[] accounts)
Called when the accounts list possibly changed, to give the SyncAdapter a chance to do any necessary bookkeeping, e.g. |
abstract void |
onSyncCanceled()
Indicate to the SyncAdapter that the last sync that was started has been cancelled. |
abstract void |
onSyncEnding(SyncContext context,
boolean success)
Called right after a sync is completed |
abstract void |
onSyncStarting(SyncContext context,
String account,
boolean forced,
SyncResult result)
Called right before a sync is started. |
TempProviderSyncAdapter.SyncData |
readSyncData(SyncableContentProvider contentProvider)
Reads the sync data from the ContentProvider |
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 |
void |
setContext(Context context)
|
void |
startSync(SyncContext syncContext,
String account,
Bundle extras)
Initiate a sync for this account. |
void |
writeSyncData(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() |
| Methods inherited from class android.content.SyncAdapter |
|---|
getISyncAdapter |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TempProviderSyncAdapter(SyncableContentProvider provider)
| Method Detail |
|---|
public final void setContext(Context context)
public final Context getContext()
public abstract void onSyncStarting(SyncContext context,
String account,
boolean forced,
SyncResult result)
context - allows you to publish status and interact with theaccount - the account to syncforced - if true then the sync was forcedresult - information to track what happened during this sync attempt
public abstract void onSyncEnding(SyncContext context,
boolean success)
context - allows you to publish status and interact with the
user during interactive syncs.success - true if the sync suceeded, false if an error occuredpublic abstract boolean isReadOnly()
public abstract void getServerDiffs(SyncContext context,
TempProviderSyncAdapter.SyncData syncData,
SyncableContentProvider tempProvider,
Bundle extras,
Object syncInfo,
SyncResult syncResult)
context - allows you to publish status and interact with the
user during interactive syncs.syncData - used to track the progress this client has made in syncing data
from the servertempProvider - this is where the diffs should be storedextras - any extra data describing the sync that is desiredsyncInfo - sync adapter-specific data that is used during a single sync operationsyncResult - information to track what happened during this sync attempt
public abstract void sendClientDiffs(SyncContext context,
SyncableContentProvider clientDiffs,
SyncableContentProvider serverDiffs,
SyncResult syncResult,
boolean dontActuallySendDeletes)
context - allows you to publish status and interact with the
user during interactive syncs.clientDiffs - the diffs from the clientserverDiffs - the SyncableContentProvider that should be populated with
the entries that were returned in response to an insert/update/delete request
to the serversyncResult - information to track what happened during this sync attemptdontActuallySendDeletes - public TempProviderSyncAdapter.SyncData readSyncData(SyncableContentProvider contentProvider)
contentProvider - the ContentProvider to read from
public TempProviderSyncAdapter.SyncData newSyncData()
public void writeSyncData(TempProviderSyncAdapter.SyncData syncData,
SyncableContentProvider contentProvider)
public abstract void onSyncCanceled()
protected void initTempProvider(SyncableContentProvider cp)
sendClientDiffs(android.content.SyncContext, android.content.SyncableContentProvider, android.content.SyncableContentProvider, android.content.SyncResult, boolean).
May copy relevant data from the underlying db into this provider so
joins, etc., can work.
cp - The ContentProvider to initialize.protected Object createSyncInfo()
public abstract void onAccountsChanged(String[] accounts)
accounts - the list of accounts
protected void logSyncDetails(long bytesSent,
long bytesReceived,
SyncResult result)
bytesSent - number of bytes the sync sent over the networkbytesReceived - number of bytes the sync received over the networkresult - The SyncResult object holding info on the sync
public void startSync(SyncContext syncContext,
String account,
Bundle extras)
SyncAdapter
startSync in class SyncAdaptersyncContext - the ISyncContext used to indicate the progress of the sync. When
the sync is finished (successfully or not) ISyncContext.onFinished() must be called.account - the account that should be syncedextras - SyncAdapter-specific parameterspublic void cancelSync()
SyncAdapter
cancelSync in class SyncAdapterprotected boolean hasTooManyDeletions(SyncStats stats)
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||