app/src/main/java/com/fjun/hassalarm/NextAlarmUpdaterJob.java
public static void scheduleJob(Context context) {
        Log.d(Constants.LOG_TAG, "Scheduling job");
        final JobInfo jobInfo = new JobInfo.Builder(JOB_ID,
                new ComponentName(context, NextAlarmUpdaterJob.class))
                .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
                .setRequiresCharging(false)
                .setRequiresDeviceIdle(false)
                .setOverrideDeadline(MAX_EXECUTION_DELAY_MS)
                .build();
        JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
        jobScheduler.schedule(jobInfo);
    }
/**
     * Schedule a job to update the next alarm once we have some kind of network connection.
     */
Schedule a job to update the next alarm once we have some kind of network connection.
Schedule a job to update the next alarm once we have some kind of network connection .
public static void scheduleJob(Context context) {
        Log.d(Constants.LOG_TAG, "Scheduling job");
        final JobInfo jobInfo = new JobInfo.Builder(JOB_ID,
                new ComponentName(context, NextAlarmUpdaterJob.class))
                .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
                .setRequiresCharging(false)
                .setRequiresDeviceIdle(false)
                .setOverrideDeadline(MAX_EXECUTION_DELAY_MS)
                .build();
        JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
        jobScheduler.schedule(jobInfo);
    }
public static void scheduleJob ( Context context ) { Log . d ( Constants . LOG_TAG , "Scheduling job" ) ; final JobInfo jobInfo = new JobInfo . Builder ( JOB_ID , new ComponentName ( context , NextAlarmUpdaterJob . class ) ) . setRequiredNetworkType ( JobInfo . NETWORK_TYPE_ANY ) . setRequiresCharging ( false ) . setRequiresDeviceIdle ( false ) . setOverrideDeadline ( MAX_EXECUTION_DELAY_MS ) . build ( ) ; JobScheduler jobScheduler = ( JobScheduler ) context . getSystemService ( Context . JOB_SCHEDULER_SERVICE ) ; jobScheduler . schedule ( jobInfo ) ; }
Schedule a job to update the next alarm once we have some kind of network connection.
Schedule a job to update the next alarm once we have some kind of network connection .