googlearchive / firebase-jobdispatcher-android

DEPRECATED please see the README.md below for details.
Apache License 2.0
1.79k stars 208 forks source link

Some mobile module not working firebase jobdispacher. #284

Closed cviacmob closed 5 years ago

cviacmob commented 5 years ago

dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(getActivity())); Bundle myExtrasBundle = new Bundle(); myExtrasBundle.putString("some_key", "some_value"); if (myJob == null) { myJob = dispatcher.newJobBuilder() // the JobService that will be called .setService(ReminderService.class) // uniquely identifies the job .setTag("my-unique-tag") // one-off job .setRecurring(true) // don't persist past a device reboot .setLifetime(Lifetime.FOREVER) // start between 0 and 20 seconds from now .setTrigger(Trigger.executionWindow(0, 20)) // don't overwrite an existing job with the same tag .setReplaceCurrent(true) // retry with exponential backoff .setRetryStrategy(RetryStrategy.DEFAULT_EXPONENTIAL) // constraints that need to be satisfied for the job to run .setConstraints( // only run on an unmetered network Constraint.ON_ANY_NETWORK,

                        // only run when the device is charging
                        Constraint.DEVICE_CHARGING
                )
                .setExtras(myExtrasBundle)
                .build();

        dispatcher.mustSchedule(myJob);
    }
cviacmob commented 5 years ago

dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(getActivity())); Bundle myExtrasBundle = new Bundle(); myExtrasBundle.putString("some_key", "some_value"); if (myJob == null) { myJob = dispatcher.newJobBuilder() // the JobService that will be called .setService(ReminderService.class) // uniquely identifies the job .setTag("my-unique-tag") // one-off job .setRecurring(true) // don't persist past a device reboot .setLifetime(Lifetime.FOREVER) // start between 0 and 20 seconds from now .setTrigger(Trigger.executionWindow(0, 20)) // don't overwrite an existing job with the same tag .setReplaceCurrent(true) // retry with exponential backoff .setRetryStrategy(RetryStrategy.DEFAULT_EXPONENTIAL) // constraints that need to be satisfied for the job to run .setConstraints( // only run on an unmetered network Constraint.ON_ANY_NETWORK,

                        // only run when the device is charging
                        Constraint.DEVICE_CHARGING
                )
                .setExtras(myExtrasBundle)
                .build();

        dispatcher.mustSchedule(myJob);
    }