Hi i am trying to use the below code snippet to cr...
# android
j
Hi i am trying to use the below code snippet to create a unique job scehdular via work manager and observe the result state but the result is outputting as null? if i use enqueWork instead of enqueUniqueWork, it works fine. Below is my code:
Copy code
val pollingWorkRequest: OneTimeWorkRequest =  OneTimeWorkRequestBuilder<TestResultsWorker>()
                .addTag(TestResultsWorker.TAG)
                .build()    
workManager.enqueueUniqueWork(TestResultsWorker.TAG, ExistingWorkPolicy.REPLACE, pollingWorkRequest)
        workManager.getWorkInfoByIdLiveData(pollingWorkRequest.id)
  .observe(
                this,
                { result ->
                    when (result.state) {
                        WorkInfo.State.SUCCEEDED -> success(result)
                        WorkInfo.State.FAILED -> failed(result)
😶 4