如何使用重试类型 RETRY_POLICY_EXPONENTIAL 指定作业中的重试次数,以下是我的代码
val job: Job =dispatcher.newJobBuilder()
.setTag("mytesttag")
.setService(MyJobService::class.java)
.setRetryStrategy(RetryStrategy.DEFAULT_EXPONENTIAL)
.build()
答案 0 :(得分:0)
知道了,可以使用 FirebaseJobDispatcher 实例来完成,就像这样
var job = dispatcher.newJobBuilder()
.setTag("mytesttag")
.setService(MyJobService::class.java)
.setRetryStrategy(dispatcher.newRetryStrategy(
RetryStrategy.RETRY_POLICY_EXPONENTIAL,30,300))
.build()