本文整理汇总了Java中android.os.PersistableBundle.putLong方法的典型用法代码示例。如果您正苦于以下问题:Java PersistableBundle.putLong方法的具体用法?Java PersistableBundle.putLong怎么用?Java PersistableBundle.putLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.PersistableBundle
的用法示例。
在下文中一共展示了PersistableBundle.putLong方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scheduleAddWatchNextRequest
import android.os.PersistableBundle; //导入方法依赖的package包/类
public static void scheduleAddWatchNextRequest(Context context, ClipData clipData) {
JobScheduler scheduler = (JobScheduler) context.getSystemService(JOB_SCHEDULER_SERVICE);
PersistableBundle bundle = new PersistableBundle();
bundle.putString(ID_KEY, clipData.getClipId());
bundle.putString(CONTENT_ID_KEY, clipData.getContentId());
bundle.putLong(DURATION_KEY, clipData.getDuration());
bundle.putLong(PROGRESS_KEY, clipData.getProgress());
bundle.putString(TITLE_KEY, clipData.getTitle());
bundle.putString(DESCRIPTION_KEY, clipData.getDescription());
bundle.putString(CARD_IMAGE_URL_KEY, clipData.getCardImageUrl());
scheduler.schedule(new JobInfo.Builder(1,
new ComponentName(context, AddWatchNextService.class))
.setMinimumLatency(0)
.setExtras(bundle)
.build());
}
示例2: start
import android.os.PersistableBundle; //导入方法依赖的package包/类
/**
* Start a QuickPeriodicJob
* @param jobId The id of the QuickPeriodicJob to start. It must match an id of a QuickPeriodicJob that was added using QuickPeriodicJobCollection.add(). If the job does not exist, nothing will happen.
* @param periodicInterval The interval in milliseconds that you want this job to run (example 30000 would be 30 seconds)
*/
public void start(int jobId, long periodicInterval) {
ComponentName component = new ComponentName(context, QuickPeriodicJobRunner.class);
JobInfo.Builder builder = new JobInfo.Builder(jobId, component);
builder.setOverrideDeadline(periodicInterval);
builder.setMinimumLatency(periodicInterval);
PersistableBundle bundle = new PersistableBundle();
bundle.putLong("interval",periodicInterval);
builder.setExtras(bundle);
JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
jobScheduler.schedule(builder.build());
storeIsJobScheduled(jobId, true, periodicInterval);
}