Firebase Job Manager does not work properly on user drives like OnePlus, Xiaomi, Lenovo

I have a task to perform, which requires the Internet and must be executed every day for an indefinite period, below is the code that I wrote to do 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 problem is that it works fine on regular devices such as Moto, Samsung, etc., but on custom ROMs such as OnePlus, Xiaomi, the task only starts when the application is opened. Has anyone encountered this problem or knew how to make it work on custom ROMs?

+6
source share

All Articles