public class SyncManager extends Object
Modifier and Type | Field and Description |
---|---|
protected ArrayList<android.content.SyncManager.ActiveSyncContext> |
mActiveSyncContexts |
protected android.content.SyncAdaptersCache |
mSyncAdapters |
Constructor and Description |
---|
SyncManager(Context context,
boolean factoryTest)
Should only be created after
ContentService.systemReady() so that
PackageManager is ready to query. |
Modifier and Type | Method and Description |
---|---|
void |
cancelActiveSync(Account account,
int userId,
String authority)
Cancel the active sync if it matches the authority and account.
|
void |
clearScheduledSyncOperations(Account account,
int userId,
String authority)
Remove scheduled sync operations.
|
protected void |
dump(FileDescriptor fd,
PrintWriter pw) |
protected void |
dumpSyncHistory(PrintWriter pw) |
protected void |
dumpSyncState(PrintWriter pw) |
SyncAdapterType[] |
getSyncAdapterTypes(int userId) |
SyncStorageEngine |
getSyncStorageEngine() |
void |
scheduleLocalSync(Account account,
int userId,
String authority) |
void |
scheduleSync(Account requestedAccount,
int userId,
String requestedAuthority,
Bundle extras,
long delay,
boolean onlyThoseWithUnkownSyncableState)
Initiate a sync.
|
void |
scheduleSyncOperation(SyncOperation syncOperation)
Create and schedule a SyncOperation.
|
void |
updateRunningAccounts() |
protected final ArrayList<android.content.SyncManager.ActiveSyncContext> mActiveSyncContexts
protected android.content.SyncAdaptersCache mSyncAdapters
public SyncManager(Context context, boolean factoryTest)
ContentService.systemReady()
so that
PackageManager
is ready to query.public void updateRunningAccounts()
public SyncStorageEngine getSyncStorageEngine()
public void scheduleSync(Account requestedAccount, int userId, String requestedAuthority, Bundle extras, long delay, boolean onlyThoseWithUnkownSyncableState)
If the ContentResolver.SYNC_EXTRAS_UPLOAD boolean in extras is true then initiate a sync that just checks for local changes to send to the server, otherwise initiate a sync that first gets any changes from the server before sending local changes back to the server.
If a specific provider is being synced (the url is non-null) then the extras can contain SyncAdapter-specific information to control what gets synced (e.g. which specific feed to sync).
You'll start getting callbacks after this.
requestedAccount
- the account to sync, may be null to signify all accountsuserId
- the id of the user whose accounts are to be synced. If userId is USER_ALL,
then all users' accounts are considered.requestedAuthority
- the authority to sync, may be null to indicate all authoritiesextras
- a Map of SyncAdapter-specific information to control
syncs of a specific provider. Can be null. Is ignored
if the url is null.delay
- how many milliseconds in the future to wait before performing thisonlyThoseWithUnkownSyncableState
- public SyncAdapterType[] getSyncAdapterTypes(int userId)
public void cancelActiveSync(Account account, int userId, String authority)
account
- limit the cancelations to syncs with this account, if non-nullauthority
- limit the cancelations to syncs with this authority, if non-nullpublic void scheduleSyncOperation(SyncOperation syncOperation)
syncOperation
- the SyncOperation to schedulepublic void clearScheduledSyncOperations(Account account, int userId, String authority)
account
- limit the removals to operations with this account, if non-nullauthority
- limit the removals to operations with this authority, if non-nullprotected void dump(FileDescriptor fd, PrintWriter pw)
protected void dumpSyncState(PrintWriter pw)
protected void dumpSyncHistory(PrintWriter pw)