androidevernoteandroid-job

Does Android Job library DailyJob start an Application class onCreate?


I use Android Job library from Evernote. Version 1.2.0.

For daily jobs I use DailyJob (https://evernote.github.io/android-job/javadoc/com/evernote/android/job/DailyJob.html) like that:

public class DailySyncJob extends DailyJob {

    public static final String TAG = "DailySyncJob";

    public static void schedule() {
        if (!JobManager.instance().getAllJobRequestsForTag(TAG).isEmpty()) {
            // job already scheduled, nothing to do
            return;
        }

        JobRequest.Builder builder = new JobRequest.Builder(TAG).setRequiredNetworkType(JobRequest.NetworkType.UNMETERED);

        // run job between 11pm and 6am
        DailyJob.schedule(builder, TimeUnit.HOURS.toMillis(23), TimeUnit.HOURS.toMillis(6));
    }

    @NonNull
    @Override
    protected DailyJobResult onRunDailyJob(Params params) {
        // do something
        return DailyJobResult.SUCCESS;
    }
}

Does onRunDailyJob start an Application class onCreate()?


Solution

  • I'm the main dev on the library. If your process isn't running, then yes your Appliction#onCreate() is called first. That's nothing specific to the library. Android works this way, if your process already died.