Beispiel #1
0
        /// <summary>
        /// Enables the periodic sync.
        /// </summary>
        void EnablePeriodicSync()
        {
            _account = AccountUtils.CreateSyncAccount(this);

            // set whether the account is syncable
            ContentResolver.SetIsSyncable(_account, AccountUtils.SyncAuthority, 1);

            // set to sync whenever it receives a network tickle
            ContentResolver.SetSyncAutomatically(_account, AccountUtils.SyncAuthority, true);

            // set to sync every x seconds
            ContentResolver.RemovePeriodicSync(_account, AccountUtils.SyncAuthority, Bundle.Empty);
            ContentResolver.AddPeriodicSync(_account, AccountUtils.SyncAuthority, Bundle.Empty, SyncFrequencySeconds);
        }