Description
If this was where the context issue was originating from then it probably has to do with removing the worker reference from this utility in combination with using some non-
RemoteListenableWorker
workers. Since the non-RemoteListenableWorker
workers would be started by the system, we wouldn't necessarily have access to the foreground service. Storing static instances of the worker is bad, not only for the reasons regarding the context, but also because multiple instances could be running at once, so you don't necessarily get the instance you expect.An alternative would be to go back to having all workers be
RemoteListenableWorker
s. Or use a sort of context manager approach in the worker such that this utility returns that context when called within that block
Originally posted by @bjester in #199 (comment)