Ank*_*pta 5 service android foreground-service kotlin-coroutines kotlin-flow
因此,我尝试在 onCreate() 中从前台服务 (LifecycleService) 中的流收集数据,但在第一次回调后,它没有提供新数据。
代码是:
override fun onCreate() {
super.onCreate()
lifecycleScope.launchWhenStarted {
repeatOnLifecycle(Lifecycle.State.STARTED) {
observeCoinsPrices()
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1386 次 |
| 最近记录: |