本文整理匯總了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));
}