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


Java PersistableBundle.putLong方法代码示例

本文整理汇总了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());
}
 
开发者ID:googlesamples,项目名称:leanback-homescreen-channels,代码行数:19,代码来源:AddWatchNextService.java

示例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);
}
 
开发者ID:simplymadeapps,项目名称:QuickPeriodicJobScheduler,代码行数:18,代码来源:QuickPeriodicJobScheduler.java


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