Account sync every minute

In my AccountAuthenticatorActivityI am trying to configure the synchronization settings for the account after addAccountExplicitlywith the following lines:

ContentResolver.setIsSyncable(account, authority, 1);
ContentResolver.setSyncAutomatically(account, authority, true);
int seconds = getResources().getInteger(R.integer.syncFrequencySeconds);
ContentResolver.addPeriodicSync(account, authority, new Bundle(), seconds);

syncFrequencySecondsset to 86400 (every 24 hours). But my sync adapter still fires every minute. What am I doing wrong? (synchronization itself works without problems)

+5
source share
2 answers

I decided for myself: the synchronizing adapter repeats when it SyncResult.statsdoes not match ContentResolver-Operations. As they are matched, synchronization starts as expected.

Update: Another problem was that I called ContentResolver.notifyUpdate during synchronization. deleted it and everything was fine.

+3
source

SyncAdapter , pollFrequency. ( SyncAdapter). SyncAdapter.

( BLE) .

, notifyChange , syncToNetwork: false ( notifyChange).

//getContext().getContentResolver().notifyChange(uri, null);
getContext().getContentResolver().notifyChange(uri, null, false);

CursorAdapter, Activity, , .

syncResult.stats .

+1

All Articles