在我的 AccountAuthenticatorActivity
中,我尝试在 addAccountExplicitly
之后使用以下行为帐户设置同步选项:
ContentResolver.setIsSyncable(account, authority, 1);
ContentResolver.setSyncAutomatically(account, authority, true);
int seconds = getResources().getInteger(R.integer.syncFrequencySeconds);
ContentResolver.addPeriodicSync(account, authority, new Bundle(), seconds);
syncFrequencySeconds
设置为 86400(每 24 小时)。但是我的同步适配器仍然每分钟触发一次。我究竟做错了什么? (同步本身没有任何问题)
最佳答案
我自己解决了:当 SyncResult.stats
与 ContentResolver-Operations 不匹配时,同步适配器会重复。当它们匹配时,同步将按预期触发。
更新:另一个问题是,我在同步操作期间调用了 ContentResolver.notifyUpdate。删除它,一切都很好。
关于android - 帐户每分钟同步一次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11272571/