本文整理汇总了Java中com.google.samples.apps.iosched.sync.TriggerSyncReceiver类的典型用法代码示例。如果您正苦于以下问题:Java TriggerSyncReceiver类的具体用法?Java TriggerSyncReceiver怎么用?Java TriggerSyncReceiver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TriggerSyncReceiver类属于com.google.samples.apps.iosched.sync包,在下文中一共展示了TriggerSyncReceiver类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: scheduleSync
import com.google.samples.apps.iosched.sync.TriggerSyncReceiver; //导入依赖的package包/类
private void scheduleSync(Context context, int syncDelay) {
// Use delay instead of jitter, since we're trying to squelch messages
int jitterMillis = syncDelay;
final String debugMessage = "Scheduling next user data sync for " + jitterMillis + "ms";
LOGI(TAG, debugMessage);
final Intent intent = new Intent(context, TriggerSyncReceiver.class);
intent.putExtra(TriggerSyncReceiver.EXTRA_USER_DATA_SYNC_ONLY, true);
((AlarmManager) context.getSystemService(Context.ALARM_SERVICE))
.set(
AlarmManager.RTC,
System.currentTimeMillis() + jitterMillis,
PendingIntent.getBroadcast(
context,
0,
intent,
PendingIntent.FLAG_CANCEL_CURRENT)
);
}
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:22,代码来源:SyncUserCommand.java
示例2: scheduleSync
import com.google.samples.apps.iosched.sync.TriggerSyncReceiver; //导入依赖的package包/类
private void scheduleSync(Context context, int syncJitter) {
int jitterMillis = (int) (RANDOM.nextFloat() * syncJitter);
final String debugMessage = "Scheduling next sync for " + jitterMillis + "ms";
LOGI(TAG, debugMessage);
((AlarmManager) context.getSystemService(Context.ALARM_SERVICE))
.set(
AlarmManager.RTC,
System.currentTimeMillis() + jitterMillis,
PendingIntent.getBroadcast(
context,
0,
new Intent(context, TriggerSyncReceiver.class),
PendingIntent.FLAG_CANCEL_CURRENT));
}
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:17,代码来源:SyncCommand.java
注:本文中的com.google.samples.apps.iosched.sync.TriggerSyncReceiver类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论