Status Update
Comments
ra...@google.com <ra...@google.com> #2
I'm not sure how to edit the description. But forgot to add that this will work when the app is in the foreground. It just doesn't work when you lock your device. I test this by moving the app to the background and then locking my device and checking the logs in Android Studio.
in...@gmail.com <in...@gmail.com> #3
It would be great if you could prioritize a fix for this issue. Additionally, if there are any alternative ways we can address this from our side, please let us know. Thank you!
in...@gmail.com <in...@gmail.com> #4
We also experienced issues with the new version 2.10.0. In our app a Job that is launched at start of the app is triggered and then immediatly cancelled because constraints are not meet anymore. I tried everything from putting it as a foreground job removing all constraints on the job but the behavior stay the same. I will rollback to 2.9.1 until it's fixed. You will find attached some logs of the WM in our app, take a look at job fec664f7-e40c-4df1-baca-3cbc7e1b1ff9.
Description
Version used: 2.7.1
Devices/Android versions reproduced on: Android 13
Hi, I understand setprogress will send update to ui when work state is in running state according to Ref:
but when i send progress before success or failure result. it is not propagated to the UI.
Is there any better way to send update, when i use success/failure to show toast, it is getting shown every time the fragment is open, because of workinfo being cached in DB
sample code:
============ TestFragment.kt
workManager.getWorkInfosForUniqueWorkFlow(workManagerUniqueName).collect{
val showToast = it.progress.getBoolean("showToast",false)
if(showToast == true){
Toast.maketext(conext," progress message", Short).show
}
}
========== ContentWorker.kt
class ContentWorker(
appContext: Context,
workerParameters: WorkerParameters):CoroutineWorker(appContext, workerParameters) {
var isFail = true
override suspend fun doWork(): Result {
//Long task
delay(2000)
return if (isFail) {
setProgress(workDataOf("showToast" to true))
// I am adding this delay in order for setProgress to send updates to UI which is collected through flow.
// delay(100)
SFLogger.debug(TAG, "doWork() - return fail")
Result.failure()
} else {
SFLogger.debug(TAG, "doWork() - return success")
Result.success()
}
}
}