是否可以从Worker(或相关类)获取LifecycleOwner?

问题描述 投票:0回答:1

我知道服务,活动和片段是LifecycleOwners,但我似乎找不到从工人那里获得LifecycleOwner的方法。有可能吗?

上下文:我正在迁移一些以前由“活动和服务”运行的任务,由Worker作为WorkManager框架的一部分来运行。某些代码通过“ this”提供了LifecycleOwner,但在Worker中,我不再具有这些引用。

android lifecycle worker
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.