use of android.app.job.JobScheduler in project android_frameworks_base by ResurrectionRemix.
the class FullBackupJob method schedule.
public static void schedule(Context ctx, long minDelay) {
JobScheduler js = (JobScheduler) ctx.getSystemService(Context.JOB_SCHEDULER_SERVICE);
JobInfo.Builder builder = new JobInfo.Builder(JOB_ID, sIdleService).setRequiresDeviceIdle(true).setRequiredNetworkType(JobInfo.NETWORK_TYPE_UNMETERED).setRequiresCharging(true);
if (minDelay > 0) {
builder.setMinimumLatency(minDelay);
}
js.schedule(builder.build());
}
use of android.app.job.JobScheduler in project android_frameworks_base by ResurrectionRemix.
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 ResurrectionRemix.
the class KeyValueBackupJob method schedule.
public static void schedule(Context ctx, long delay) {
synchronized (KeyValueBackupJob.class) {
if (!sScheduled) {
if (delay <= 0) {
delay = BATCH_INTERVAL + new Random().nextInt(FUZZ_MILLIS);
}
if (BackupManagerService.DEBUG_SCHEDULING) {
Slog.v(TAG, "Scheduling k/v pass in " + (delay / 1000 / 60) + " minutes");
}
JobScheduler js = (JobScheduler) ctx.getSystemService(Context.JOB_SCHEDULER_SERVICE);
JobInfo.Builder builder = new JobInfo.Builder(JOB_ID, sKeyValueJobService).setMinimumLatency(delay).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY).setRequiresCharging(true).setOverrideDeadline(MAX_DEFERRAL);
js.schedule(builder.build());
sNextScheduled = System.currentTimeMillis() + delay;
sScheduled = true;
}
}
}
use of android.app.job.JobScheduler in project android_frameworks_base by DirtyUnicorns.
the class MainActivity method cancelAllJobs.
public void cancelAllJobs(View v) {
JobScheduler tm = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE);
tm.cancelAll();
}
use of android.app.job.JobScheduler in project android_frameworks_base by DirtyUnicorns.
the class TestJobService method scheduleJob.
/** Send job to the JobScheduler. */
public void scheduleJob(JobInfo job) {
Log.d(TAG, "Scheduling job " + job);
JobScheduler tm = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE);
tm.schedule(job);
}
Aggregations