AutoSync Android startup interval?

Does anyone know that when you turn on auto-sync, how often do Google accounts sync across apps? I know it almost instantly for Gmail, but what about other things? for example, if I have a Picasa application that uses the SyncAdapter to synchronize local photos with online sites, how often will onPerformSync be called?

Also, is it possible to override this interval?

+6
android sync
source share
2 answers

AutoSync will start when you change to DataSources.

Eg. If you have a SyncAdapter for contacts that is configured for automatic synchronization, then onPerformSync is called when contacts change after a delay of 30 seconds.

+2
source share

I found another work to adjust this delay (this can lead to other side effects, check the step below carefully)

This is using a combination of ContentObserver and AccountManager api. Following are the steps:

  • Register ContentObserver in the contact database.
  • Whenever db contacts change, onChange of your contentObserver will be launched. Inside this function, cancel the pending syncRequests, as shown below. `ContentResolver.cancelSync (account, ContactsContract.AUTHORITY);
  • Now schedule the synchronization according to the required delay.

The above will have a side effect of allowing ContentObserver to be alive all the time, and this is not recommended.

+1
source share

All Articles