本文整理汇总了Java中org.chromium.sync.notifier.InvalidationPreferences.getSavedSyncedAccount方法的典型用法代码示例。如果您正苦于以下问题:Java InvalidationPreferences.getSavedSyncedAccount方法的具体用法?Java InvalidationPreferences.getSavedSyncedAccount怎么用?Java InvalidationPreferences.getSavedSyncedAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.chromium.sync.notifier.InvalidationPreferences
的用法示例。
在下文中一共展示了InvalidationPreferences.getSavedSyncedAccount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refreshRegisteredTypes
import org.chromium.sync.notifier.InvalidationPreferences; //导入方法依赖的package包/类
/**
* Reads all stored preferences and calls
* {@link #setRegisteredTypes(android.accounts.Account, boolean, java.util.Set)} with the stored
* values, refreshing the set of types with {@code types}. It can be used on startup of Chrome
* to ensure we always have a set of registrations consistent with the native code.
* @param types Set of types for which to register.
*/
public void refreshRegisteredTypes(Set<ModelType> types) {
InvalidationPreferences invalidationPreferences = new InvalidationPreferences(mContext);
Set<String> savedSyncedTypes = invalidationPreferences.getSavedSyncedTypes();
Account account = invalidationPreferences.getSavedSyncedAccount();
boolean allTypes = savedSyncedTypes != null &&
savedSyncedTypes.contains(ModelType.ALL_TYPES_TYPE);
setRegisteredTypes(account, allTypes, types);
}
示例2: setRegisteredObjectIds
import org.chromium.sync.notifier.InvalidationPreferences; //导入方法依赖的package包/类
/**
* Sets object ids for which the client should register for notification. This is intended for
* registering non-Sync types; Sync types are registered with {@code setRegisteredTypes}.
*
* @param objectSources The sources of the objects.
* @param objectNames The names of the objects.
*/
@CalledByNative
public void setRegisteredObjectIds(int[] objectSources, String[] objectNames) {
InvalidationPreferences invalidationPreferences = new InvalidationPreferences(mContext);
Account account = invalidationPreferences.getSavedSyncedAccount();
Intent registerIntent =
InvalidationIntentProtocol.createRegisterIntent(
account, objectSources, objectNames);
registerIntent.setClass(mContext, InvalidationService.class);
mContext.startService(registerIntent);
}