本文整理汇总了Java中org.chromium.sync.notifier.InvalidationPreferences类的典型用法代码示例。如果您正苦于以下问题:Java InvalidationPreferences类的具体用法?Java InvalidationPreferences怎么用?Java InvalidationPreferences使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InvalidationPreferences类属于org.chromium.sync.notifier包,在下文中一共展示了InvalidationPreferences类的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);
}
开发者ID:morristech,项目名称:android-chromium,代码行数:16,代码来源:InvalidationController.java
示例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);
}
开发者ID:morristech,项目名称:android-chromium,代码行数:18,代码来源:InvalidationController.java
注:本文中的org.chromium.sync.notifier.InvalidationPreferences类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论