ContentResolver.addPeriodicSync doesn’t work – never syncs

By  | March 7, 2014 | Filed under: Software development

Probably you’ve followed Google’s Android sync adaptor training guide up to http://developer.android.com/training/sync-adapters/running-sync-adapter.html#RunPeriodic and are wondering why syncing never happens.

There are two mistakes in the training guide as far as explaining how to make addPeriodicSync work:

  1. You must call ContentResolver.setSyncAutomatically with true as the third (sync) parameter to enable syncing for your adaptor.
  2. The fourth (pollFrequency) parameter of ContentResolver.addPeriodicSync is a number of seconds, as stated here, and not milliseconds, as implied in the training guide. The demo code for addPeriodicSync in the training guide will cause a sync once every thousand hours instead of once an hour.

5 Responses to ContentResolver.addPeriodicSync doesn’t work – never syncs

  1. Edu Rodríguez May 23, 2014 at 12:30 pm

    Thanks,

    This solve my problem with addPeriodicSync and sample code :-/

  2. Ezequiel September 9, 2014 at 12:26 am

    Thanks!! This is the only place I found where somebody mentions the ContentResolver.setSyncAutomatically thing.

  3. Pingback: [android] Sync Adapter | PipisCrew Official Homepage

  4. Pingback: Android Programming | archartfact

  5. droiddude July 10, 2016 at 1:05 pm

    your first point of setting ContentResolver.setSyncAutomatically fixed the problem. i wonder why google missed this point!

Leave a Reply

Your email address will not be published. Required fields are marked *