2

如何使用重试类型RETRY_POLICY_EXPONENTIAL指定作业中的重试次数,下面是我的代码

    val job: Job =dispatcher.newJobBuilder()
            .setTag("mytesttag")
            .setService(MyJobService::class.java)
            .setRetryStrategy(RetryStrategy.DEFAULT_EXPONENTIAL)
            .build()
4

1 回答 1

0

知道了,可以使用FirebaseJobDispatcher 实例来完成,像这样

        var job = dispatcher.newJobBuilder()
                .setTag("mytesttag")
                .setService(MyJobService::class.java)
                .setRetryStrategy(dispatcher.newRetryStrategy(                        
                 RetryStrategy.RETRY_POLICY_EXPONENTIAL,30,300))
                .build()
于 2017-12-26T10:32:13.403 回答