Firebase Job Dispatcher not working properly on Custom ROMs like OnePlus, Xiaomi, Lenovo

562 Views Asked by At

I have a task to perform which requires internet and has to be performed everyday indefinitely, below is the code I had written to perform the same

FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(this));
        Job myJob = dispatcher.newJobBuilder()
                .setService(FirebaseJobDispatcherService.class) // the JobService that will be called
                .setTag(Constants.ALERT_TAG)        // uniquely identifies the job
                .setRecurring(true)
                .setLifetime(Lifetime.FOREVER)
                .setReplaceCurrent(true)
                .setRetryStrategy(RetryStrategy.DEFAULT_LINEAR)
                .setTrigger(Trigger.executionWindow(0, (int) TimeUnit.DAYS.toSeconds(1)))
                .setConstraints(Constraint.ON_ANY_NETWORK)
                .build();

        dispatcher.mustSchedule(myJob);

Now the issue is, it works properly on normal devices like Moto, Samsung etc but on Custom ROMs like OnePlus, Xiaomi the job triggers only when the app is opened. Has anyone faced this issue or know how to make it work properly on Custom ROMs as well?

0

There are 0 best solutions below