Android kotlin WorkManger不支持';t返回Worker.Result.FAILURE

Android kotlin WorkManger不支持';t返回Worker.Result.FAILURE,android,kotlin,android-workmanager,Android,Kotlin,Android Workmanager,我正在使用lates WorkManger Kotlin库“1.0.0-alpha09”。 有时doWork()返回Worker.Result.FAILURE状态时,在WorkContinuation.getStatuses()处未收到状态 最糟糕的是,我不明白为什么有时候它没有得到应有的地位 fun WorkContinuation.observeStatus(): WorkContinuation { statuses.observeForever { /

我正在使用lates WorkManger Kotlin库“1.0.0-alpha09”。 有时
doWork()
返回
Worker.Result.FAILURE
状态时,在
WorkContinuation.getStatuses()
处未收到状态

最糟糕的是,我不明白为什么有时候它没有得到应有的地位

fun WorkContinuation.observeStatus(): WorkContinuation {
        statuses.observeForever {
          // status should come here but sometimes it doesn't
        }
        return this
    }


final override fun doWork(): Result {
        return try {
            // do some work (retrofit network request)
            Worker.Result.SUCCESS

        } catch (error: Throwable) {
            // this status is not receiving by LiveData observer sometimes
            Worker.Result.FAILURE
        }

doWork的返回值还有另一种可能性,即
Worker.Result.RETRY
可能缺少重试值,并且由于没有可丢弃的错误,因此不会出现异常。顺便说一句,我不是很确定。@alperenkantarchı我只需要返回失败状态即可。不需要重试