android.content
public
abstract
class
android.content.TempProviderSyncAdapter
Nested Classes
Summary
Public Constructors
Public Methods
|
|
|
|
|
void |
cancelSync() |
|
|
final |
|
|
Context |
getContext() |
abstract |
|
|
|
|
void |
getServerDiffs(SyncContext context, TempProviderSyncAdapter.SyncData syncData, SyncableContentProvider tempProvider, Bundle extras, Object syncInfo, SyncResult syncResult) |
abstract |
|
|
|
|
boolean |
isReadOnly() |
|
|
|
|
|
TempProviderSyncAdapter.SyncData |
newSyncData() |
abstract |
|
|
|
|
void |
onAccountsChanged(String[] accounts) |
abstract |
|
|
|
|
void |
onSyncCanceled() |
abstract |
|
|
|
|
void |
onSyncEnding(SyncContext context, boolean success) |
abstract |
|
|
|
|
void |
onSyncStarting(SyncContext context, String account, boolean forced, SyncResult result) |
|
|
|
|
|
TempProviderSyncAdapter.SyncData |
readSyncData(SyncableContentProvider contentProvider) |
abstract |
|
|
|
|
void |
sendClientDiffs(SyncContext context, SyncableContentProvider clientDiffs, SyncableContentProvider serverDiffs, SyncResult syncResult, boolean dontActuallySendDeletes) |
|
|
final |
|
|
void |
setContext(Context context) |
|
|
|
|
|
void |
startSync(SyncContext syncContext, String account, Bundle extras) |
|
|
|
|
|
void |
writeSyncData(TempProviderSyncAdapter.SyncData syncData, SyncableContentProvider contentProvider) |
Protected Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Public Constructors
Public Methods
public
void
cancelSync()
Cancel the most recently initiated sync. Due to race conditions, this may arrive
after the ISyncContext.onFinished() for that sync was called. IPC invocations
of this method and startSync() are guaranteed to be serialized.
public
final
Context
getContext()
Retrieve the Context this adapter is running in. Only available
once onSyncStarting() is called (not available from constructor).
Get diffs from the server since the last completed sync and put them
into a temporary provider.
Parameters
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 server |
tempProvider
| this is where the diffs should be stored |
extras
| any extra data describing the sync that is desired |
syncInfo
| sync adapter-specific data that is used during a single sync operation |
syncResult
| information to track what happened during this sync attempt
|
public
abstract
boolean
isReadOnly()
Implement this to return true if the data in your content provider
is read only.
Create and return a new, empty SyncData object
public
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.
to make sure that any required SubscribedFeeds subscriptions
exist.
Parameters
accounts
| the list of accounts
|
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
Parameters
context
| allows you to publish status and interact with the
user during interactive syncs. |
success
| true if the sync suceeded, false if an error occured
|
public
abstract
void
onSyncStarting(SyncContext context, String account, boolean forced, SyncResult result)
Called right before a sync is started.
Parameters
context
| allows you to publish status and interact with the |
account
| the account to sync |
forced
| if true then the sync was forced |
result
| information to track what happened during this sync attempt |
Returns
- true, if the sync was successfully started. One reason it can
fail to start is if there is no user configured on the device.
Reads the sync data from the ContentProvider
Parameters
contentProvider
| the ContentProvider to read from |
Returns
- the SyncData for the provider. This may be null.
Send client diffs to the server, optionally receiving more diffs from the server
Parameters
context
| allows you to publish status and interact with the
user during interactive syncs. |
clientDiffs
| the diffs from the client |
serverDiffs
| the SyncableContentProvider that should be populated with
the entries that were returned in response to an insert/update/delete request
to the server |
syncResult
| information to track what happened during this sync attempt |
public
final
void
setContext(Context context)
public
void
startSync(SyncContext syncContext, String account, Bundle extras)
Initiate a sync for this account. SyncAdapter-specific parameters may
be specified in extras, which is guaranteed to not be null. IPC invocations
of this method and cancelSync() are guaranteed to be serialized.
Parameters
syncContext
| 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 synced |
extras
| SyncAdapter-specific parameters
|
Stores the sync data in the Sync Stats database, keying it by
the account that was set in the last call to onSyncStarting()
Protected Methods
protected
Object
createSyncInfo()
protected
boolean
hasTooManyDeletions(SyncStats stats)
protected
void
logSyncDetails(long bytesSent, long bytesReceived)
Logs details on the sync.
Normally this will be overridden by a subclass that will provide
provider-specific details.
Parameters
bytesSent
| number of bytes the sync sent over the network |
bytesReceived
| number of bytes the sync received over the network
|