当前位置: 首页>>代码示例>>Java>>正文


Java TriggerSyncReceiver类代码示例

本文整理汇总了Java中com.google.android.apps.iosched.sync.TriggerSyncReceiver的典型用法代码示例。如果您正苦于以下问题:Java TriggerSyncReceiver类的具体用法?Java TriggerSyncReceiver怎么用?Java TriggerSyncReceiver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TriggerSyncReceiver类属于com.google.android.apps.iosched.sync包,在下文中一共展示了TriggerSyncReceiver类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: scheduleSync

import com.google.android.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 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:TheDeltaProgram,项目名称:iosched2013,代码行数:19,代码来源:SyncUserCommand.java

示例2: scheduleSync

import com.google.android.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:TheDeltaProgram,项目名称:iosched2013,代码行数:17,代码来源:SyncCommand.java

示例3: onMessage

import com.google.android.apps.iosched.sync.TriggerSyncReceiver; //导入依赖的package包/类
@Override
protected void onMessage(Context context, Intent intent) {
    if (UIUtils.isGoogleTV(context)) {
        // Google TV uses SyncHelper directly.
        return;
    }
    String announcement = intent.getStringExtra("announcement");
    if (announcement != null) {
        displayNotification(context, announcement);
        return;
    }

    int jitterMillis = (int) (sRandom.nextFloat() * TRIGGER_SYNC_MAX_JITTER_MILLIS);
    final String debugMessage = "Received message to trigger sync; "
            + "jitter = " + jitterMillis + "ms";
    LOGI(TAG, debugMessage);

    if (BuildConfig.DEBUG) {
      displayNotification(context, debugMessage);
    }

    ((AlarmManager) context.getSystemService(ALARM_SERVICE))
            .set(
                    AlarmManager.RTC,
                    System.currentTimeMillis() + jitterMillis,
                    PendingIntent.getBroadcast(
                            context,
                            0,
                            new Intent(context, TriggerSyncReceiver.class),
                            PendingIntent.FLAG_CANCEL_CURRENT));
}
 
开发者ID:amardeshbd,项目名称:google-iosched,代码行数:32,代码来源:GCMIntentService.java


注:本文中的com.google.android.apps.iosched.sync.TriggerSyncReceiver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。