本文整理汇总了Java中com.google.ipc.invalidation.ticl.android2.AndroidClock.nowMs方法的典型用法代码示例。如果您正苦于以下问题:Java AndroidClock.nowMs方法的具体用法?Java AndroidClock.nowMs怎么用?Java AndroidClock.nowMs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.ipc.invalidation.ticl.android2.AndroidClock
的用法示例。
在下文中一共展示了AndroidClock.nowMs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: issueDelayedRegistrationIntent
import com.google.ipc.invalidation.ticl.android2.AndroidClock; //导入方法依赖的package包/类
/** Issues a registration retry with delay. */
static void issueDelayedRegistrationIntent(Context context, AndroidClock clock,
ByteString clientId, ObjectId objectId, boolean isRegister, int delayMs, int requestCode) {
RegistrationCommand command = isRegister ?
AndroidListenerProtos.newDelayedRegisterCommand(clientId, objectId) :
AndroidListenerProtos.newDelayedUnregisterCommand(clientId, objectId);
Intent intent = new Intent()
.putExtra(EXTRA_REGISTRATION, command.toByteArray())
.setClass(context, AlarmReceiver.class);
// Create a pending intent that will cause the AlarmManager to fire the above intent.
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, requestCode, intent,
PendingIntent.FLAG_ONE_SHOT);
// Schedule the pending intent after the appropriate delay.
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
long executeMs = clock.nowMs() + delayMs;
alarmManager.set(AlarmManager.RTC, executeMs, pendingIntent);
}