在 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/