更新时间:2023-11-10 20:53:34
如果你没有定期同步设置,同步会发生,如果你的code明确要求 ContentResolver.requestSync(客户账户,串权威,捆绑演员)
您的帐户和权限。
If you have no periodic sync setup, Sync will happen if your code explicitly calls ContentResolver.requestSync(Account account, String authority, Bundle extras)
with your account and authority.
另外,如果您的ContentProvider插入,更新或删除函数调用 ContentResolver.notifyChange(URI URI,ContentObserver观测,布尔syncToNetwork)
,如果布尔syncToNetwork为true(默认值),它也将触发同步。有一个短暂的延迟在这里引起,确保一批数据库的变化不仅会导致一个同步,每改变一个也没有。请注意,您的code应该叫有NotifyChange
,因为它的信号是如何的Android你的UI,该UI是反映已经改变的内容之后更新。
Also, if your ContentProvider insert or update or delete functions call ContentResolver.notifyChange(Uri uri, ContentObserver observer, boolean syncToNetwork)
, if the bool syncToNetwork is true (the default), it will also trigger a sync. There's a short delay induced here, to ensure that a batch of database changes only causes one sync, not one per change. Note that your code should be calling notifyChange
because it's how Android signals your UI to update after Content that the UI is reflecting had been changed.
如果服务器数据库的变化,您的应用程序不会知道,因为同步没有发生。有两个选项:
If the server database changes, your app won't know, because sync isn't happening. Two options: