android - sync_extras_upload 有什么用?

标签 android android-syncadapter

在 ContentResolver 类中,有几个用于同步器的常量。我想知道常量 SYNC_EXTRAS_UPLOAD 有什么用?

最佳答案

如果您 checkin SyncManager.java 文件,您会发现这条评论:

If the ContentResolver.SYNC_EXTRAS_UPLOAD boolean in extras is * true then initiate a sync that just checks for local changes to send * to the server, otherwise initiate a sync that first gets any * changes from the server before sending local changes back to * the server.

在同一个文件中,这是 scheduleLocalSync API 的实现

public void scheduleLocalSync(Account account, String authority) {
    final Bundle extras = new Bundle();
    extras.putBoolean(ContentResolver.SYNC_EXTRAS_UPLOAD, true);
    scheduleSync(account, authority, extras, LOCAL_SYNC_DELAY,
            false /* onlyThoseWithUnkownSyncableState */);
}

syncadapter 的方法 onPerformSync 将这些额外内容作为参数之一接收

关于android - sync_extras_upload 有什么用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8949430/

相关文章:

android - xmpp 入口 getType

java - Android ScrollView 添加新行

android - 使用同步适配器来维护传入的提要

Android CalendarContract,删除重复事件会导致所有事件在日历上消失?

android - 使用 addPeriodicSync 时停止同步适配器进行初始同步

android - 使用离线同步设计 Android 应用程序。我应该使用 SyncAdapter 吗?

android - 我想在 map 上添加标记并缩放到该位置

android - MapView 渲染,中间缺少 "x"的图 block

android - 是否可以获得您的行车路线经过的所有邮政编码的列表?

Android SyncAdapter频率