帐户同步每分钟

ole*_*leh 5 android android-syncadapter

在我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);
Run Code Online (Sandbox Code Playgroud)

syncFrequencySeconds设置为86400(每24小时).但我的同步适配器仍然每分钟触发一次.我究竟做错了什么?(同步本身没有任何问题)

ole*_*leh 4

SyncResult.stats我自己解决了:当与 ContentResolver-Operations 不匹配时,同步适配器会重复。当它们匹配时,同步就会按预期触发。

更新:另一个问题是,我在同步操作期间调用了 ContentResolver.notifyUpdate。删除它,就很好了。