Search in sources :

Example 61 with JobScheduler

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;
    }
}
Also used : JobScheduler(android.app.job.JobScheduler)

Example 62 with JobScheduler

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());
}
Also used : JobScheduler(android.app.job.JobScheduler) JobInfo(android.app.job.JobInfo)

Example 63 with JobScheduler

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();
}
Also used : JobScheduler(android.app.job.JobScheduler)

Aggregations

JobScheduler (android.app.job.JobScheduler)63 JobInfo (android.app.job.JobInfo)42 ComponentName (android.content.ComponentName)13 NotificationManager (android.app.NotificationManager)5 Calendar (java.util.Calendar)5 Random (java.util.Random)5 AlarmManager (android.app.AlarmManager)2 SharedPreferences (android.content.SharedPreferences)2 Account (android.accounts.Account)1 AccountManager (android.accounts.AccountManager)1 SuppressLint (android.annotation.SuppressLint)1 ConnectivityManager (android.net.ConnectivityManager)1 Bundle (android.os.Bundle)1 PersistableBundle (android.os.PersistableBundle)1 UiThread (android.support.annotation.UiThread)1 Test (org.junit.Test)1