Bug P3
Status Update
Comments
gr...@gmail.com <gr...@gmail.com> #3
Has there been updates to the User's concern?
I was testing the setRequiresCharging(true) Constraint. I ran my Worker with the Device currently charging, but as soon as I stopped charging, the Worker did not stop.
This behavior went against the documentation that running Workers are stopped when the Constraints are unmet.
I'm using a Samsung Galaxy S21 FE to test the behavior.
I was testing the setRequiresCharging(true) Constraint. I ran my Worker with the Device currently charging, but as soon as I stopped charging, the Worker did not stop.
This behavior went against the documentation that running Workers are stopped when the Constraints are unmet.
I'm using a Samsung Galaxy S21 FE to test the behavior.
Description
Component used: work-runtime-ktx Version used: 2.7.1 Devices/Android versions reproduced on: N/A
The documentation page says:
(source:https://developer.android.com/topic/libraries/architecture/workmanager/how-to/managing-work?#stop-worker )
My questions are about clearing up the last 2 bullet points.
When is the worker stopped when constraints are no longer met? Instantly? E.g. if there is a network connection constraint and the network connection drops (e.g. for a millisecond, or a second, or a minute, or a week), when is the worker stopped? That is not clear from the documentation. I'm assuming that the stop command is instant, because it's not specified. Is that correct? Consider specifying this.
The last bullet point mentions explicitly that work is scheduled for retry. Does that implicitly mean that work is not scheduled for retry after it's stopped when constraints are no longer met? Consider explicitly making this clear.
Side note: if stopped work after constraints are no longer met doesn't restart even when the constraints are met again, then this would break the guarantee that WorkManager ensures that work runs. This implicitly means that stopped work should restart when constraints are met again, but the linked documentation page fails to mention this. Hence my doubt, and this issue/question.