を繰り返して、私は私が仕事を持つことができることを確認Trigger.NOWまたは0,0の時間を使って今すぐ開始:Firebase Jobdispatcher - 今起動して、この例パー
Bundle myExtrasBundle = new Bundle();
myExtrasBundle.putString("some_key", "some_value");
Job myJob = dispatcher.newJobBuilder()
// the JobService that will be called
.setService(MyJobService.class)
// uniquely identifies the job
.setTag("my-unique-tag")
// one-off job
.setRecurring(false)
// don't persist past a device reboot
.setLifetime(Lifetime.UNTIL_NEXT_BOOT)
// start between 0 and 60 seconds from now
.setTrigger(Trigger.executionWindow(0, 60))
// don't overwrite an existing job with the same tag
.setReplaceCurrent(false)
// 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_UNMETERED_NETWORK,
// only run when the device is charging
Constraint.DEVICE_CHARGING
)
.setExtras(myExtrasBundle)
.build();
dispatcher.mustSchedule(myJob);
私の質問は次のとおりです。
ジョブを今すぐ開始するように設定するにはどうすればいいですか?[時間間隔](それは15分と呼ぶことができます)?
.setRecurring(true) //true mean repeat it
.setTrigger(Trigger.executionWindow(start, end))
start
:あなたの仕事の繰り返しは、定期的にこれらの2つのメソッドを呼び出すようにするに
AlarmManagerを使用して15分おきにこのタスクを起動してください – Fakher
私たちは実際にアラームマネージャー – Psest328