My current Android app employs androidx.work:work-runtime:2.2.0-rc01
My Worker code resembles this:-
class SyncWorker(context: Context,
Its working as expected as per the documentation which for "Worker" class says:
Once you return from this * method, the Worker is considered to have finished what its doing and will be destroyed. If * you need to do your work asynchronously on a thread of your own choice
And also for onStopped() method of ListenableWorker class.
/**
* This method is invoked when this Worker has been told to stop. This could happen due
* to an explicit cancellation signal by the user, or because the system has decided to preempt
* the task. In these cases, the results of the work will be ignored by WorkManager. All
* processing in this method should be lightweight - there are no contractual guarantees about
* which thread will invoke this call, so this should not be a long-running or blocking
* operation.
*/