I'm using an AbstractThreadedSyncAdapter
to synchronize some data with my server. I'm using SyncResult
to indicate if there's been an error while performing the synchronization:
syncResult.stats.numParseExceptions++;
I initialize the SyncAdapter like this:
Bundle params = new Bundle();
params.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, false);
params.putBoolean(ContentResolver.SYNC_EXTRAS_DO_NOT_RETRY, false);
params.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, false);
ContentResolver.addPeriodicSync(account, CONTENT, params, 3600);
ContentResolver.setSyncAutomatically(account, CONTENT, true);
ContentResolver.requestSync(account, CONTENT, new Bundle());
If the synchronization fails I want it to retry after 5 minutes (periodic sync time is 1 hour). I thought that I had to use syncResult.delayUntil
, but the synchronization isn't retried.
How can I do it?
Documentation say's: (http://developer.android.com/reference/android/content/ContentResolver.html#addPeriodicSync(android.accounts.Account, java.lang.String, android.os.Bundle, long))
Maybe that's the problem. Try remove this params - may work. Write if it helps.
Or You forgot permissions: