本文整理汇总了Java中android.app.job.JobInfo.getService方法的典型用法代码示例。如果您正苦于以下问题:Java JobInfo.getService方法的具体用法?Java JobInfo.getService怎么用?Java JobInfo.getService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.job.JobInfo
的用法示例。
在下文中一共展示了JobInfo.getService方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: schedule
import android.app.job.JobInfo; //导入方法依赖的package包/类
@Override
public int schedule(JobInfo job) throws RemoteException {
int vuid = VBinder.getCallingUid();
int id = job.getId();
ComponentName service = job.getService();
JobId jobId = new JobId(vuid, service.getPackageName(), id);
JobConfig config = mJobStore.get(jobId);
if (config == null) {
config = new JobConfig(mGlobalJobId++, service.getClassName(), job.getExtras());
mJobStore.put(jobId, config);
} else {
config.serviceName = service.getClassName();
config.extras = job.getExtras();
}
saveJobs();
mirror.android.app.job.JobInfo.jobId.set(job, config.virtualJobId);
mirror.android.app.job.JobInfo.service.set(job, mJobProxyComponent);
return mScheduler.schedule(job);
}
示例2: assertJobScheduled
import android.app.job.JobInfo; //导入方法依赖的package包/类
/**
* Asserts that an {@link UpdateWidgetsJobService} job was scheduled.
*
* @param context the application context
*/
public static void assertJobScheduled(Context context) {
JobScheduler jobScheduler = context.getSystemService(JobScheduler.class);
JobInfo jobInfo = jobScheduler.getPendingJob(UpdateWidgetsJobService.JOB_ID);
ComponentName component = jobInfo.getService();
assertThat(component.getPackageName(), is("io.github.tobyhs.usbdebugstatus"));
assertThat(component.getShortClassName(), is(".UpdateWidgetsJobService"));
assertThat(jobInfo.getTriggerContentUris(), arrayWithSize(1));
JobInfo.TriggerContentUri triggerUri = jobInfo.getTriggerContentUris()[0];
assertThat(triggerUri.getUri(), is(Settings.Global.getUriFor(Settings.Global.ADB_ENABLED)));
assertThat(jobInfo.getTriggerContentMaxDelay(), is(UpdateWidgetsJobService.JOB_MAX_DELAY_MS));
}