SyncRequest.Builder.SyncPeriodic(Int64, Int64) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Build a periodic sync. Either this or syncOnce() must be called for this builder. Syncs are identified by target android.provider and by the contents of the extras bundle. You cannot reuse the same builder for one-time syncs after having specified a periodic sync (by calling this function). If you do, an IllegalArgumentException will be thrown. The bundle for a periodic sync can be queried by applications with the correct permissions using ContentResolver.getPeriodicSyncs(Account,String) , so no sensitive data should be transferred here. Example usage. Request a periodic sync every 5 hours with 20 minutes of flex. SyncRequest.Builder builder = (new SyncRequest.Builder()).syncPeriodic(5 * HOUR_IN_SECS, 20 * MIN_IN_SECS); Schedule a periodic sync every hour at any point in time during that hour. SyncRequest.Builder builder = (new SyncRequest.Builder()).syncPeriodic(1 * HOUR_IN_SECS, 1 * HOUR_IN_SECS); N.B.: Periodic syncs are not allowed to have any of ContentResolver.SYNC_EXTRAS_DO_NOT_RETRY , ContentResolver.SYNC_EXTRAS_IGNORE_BACKOFF , ContentResolver.SYNC_EXTRAS_IGNORE_SETTINGS , ContentResolver.SYNC_EXTRAS_INITIALIZE , ContentResolver.SYNC_EXTRAS_FORCE , ContentResolver.SYNC_EXTRAS_EXPEDITED , ContentResolver.SYNC_EXTRAS_MANUAL , ContentResolver.SYNC_EXTRAS_SCHEDULE_AS_EXPEDITED_JOB set to true. If any are supplied then an IllegalArgumentException will be thrown.
[Android.Runtime.Register("syncPeriodic", "(JJ)Landroid/content/SyncRequest$Builder;", "GetSyncPeriodic_JJHandler")]
public virtual Android.Content.SyncRequest.Builder? SyncPeriodic(long pollFrequency, long beforeSeconds);
[<Android.Runtime.Register("syncPeriodic", "(JJ)Landroid/content/SyncRequest$Builder;", "GetSyncPeriodic_JJHandler")>]
abstract member SyncPeriodic : int64 * int64 -> Android.Content.SyncRequest.Builder
override this.SyncPeriodic : int64 * int64 -> Android.Content.SyncRequest.Builder
Parameters
- pollFrequency
- Int64
the amount of time in seconds that you wish to elapse between periodic syncs. A minimum period of 1 hour is enforced.
- beforeSeconds
- Int64
the amount of flex time in seconds before pollFrequency that you permit for the sync to take place. Must be less than pollFrequency and greater than MAX(5% of pollFrequency , 5 minutes)
Returns
Build a periodic sync. Either this or syncOnce() must be called for this builder. Syncs are identified by target android.provider and by the contents of the extras bundle. You cannot reuse the same builder for one-time syncs after having specified a periodic sync (by calling this function). If you do, an IllegalArgumentException will be thrown. The bundle for a periodic sync can be queried by applications with the correct permissions using ContentResolver.getPeriodicSyncs(Account,String) , so no sensitive data should be transferred here. Example usage. Request a periodic sync every 5 hours with 20 minutes of flex. SyncRequest.Builder builder = (new SyncRequest.Builder()).syncPeriodic(5 * HOUR_IN_SECS, 20 * MIN_IN_SECS); Schedule a periodic sync every hour at any point in time during that hour. SyncRequest.Builder builder = (new SyncRequest.Builder()).syncPeriodic(1 * HOUR_IN_SECS, 1 * HOUR_IN_SECS); N.B.: Periodic syncs are not allowed to have any of ContentResolver.SYNC_EXTRAS_DO_NOT_RETRY , ContentResolver.SYNC_EXTRAS_IGNORE_BACKOFF , ContentResolver.SYNC_EXTRAS_IGNORE_SETTINGS , ContentResolver.SYNC_EXTRAS_INITIALIZE , ContentResolver.SYNC_EXTRAS_FORCE , ContentResolver.SYNC_EXTRAS_EXPEDITED , ContentResolver.SYNC_EXTRAS_MANUAL , ContentResolver.SYNC_EXTRAS_SCHEDULE_AS_EXPEDITED_JOB set to true. If any are supplied then an IllegalArgumentException will be thrown.
- Attributes
Remarks
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Java documentation for android.content.SyncRequest.Builder.syncPeriodic(long, long).