use of android.app.job.JobScheduler in project android_frameworks_base by crdroidandroid.
the class KeyValueBackupJob method cancel.
public static void cancel(Context ctx) {
synchronized (KeyValueBackupJob.class) {
JobScheduler js = (JobScheduler) ctx.getSystemService(Context.JOB_SCHEDULER_SERVICE);
js.cancel(JOB_ID);
sNextScheduled = 0;
sScheduled = false;
}
}
use of android.app.job.JobScheduler in project android_frameworks_base by crdroidandroid.
the class DiskStatsLoggingService method schedule.
/**
* Schedules a DiskStats collection task. This task only runs on device idle while charging
* once every 24 hours.
* @param context Context to use to get a job scheduler.
*/
public static void schedule(Context context) {
JobScheduler js = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
js.schedule(new JobInfo.Builder(JOB_DISKSTATS_LOGGING, sDiskStatsLoggingService).setRequiresDeviceIdle(true).setRequiresCharging(true).setPeriodic(TimeUnit.DAYS.toMillis(1)).build());
}
use of android.app.job.JobScheduler in project android_frameworks_base by crdroidandroid.
the class MainActivity method cancelAllJobs.
public void cancelAllJobs(View v) {
JobScheduler tm = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE);
tm.cancelAll();
}
Aggregations