https://kotlinlang.org logo
j

Julius Marozas

09/28/2020, 11:42 AM
Hi, how can I observe when the application is in background? What's the alternative to onStart/onStop lifecycle methods in Compose?
z

Zach Klippenstein (he/him) [MOD]

09/28/2020, 12:22 PM
Nothing, at least right now. You'd still need to use the regular activity hooks for that stuff.
👍 1
f

flosch

09/28/2020, 1:50 PM
there is a
LifecycleOwnerAmbient
that you can use
i

Ian Lake

09/28/2020, 4:24 PM
What are you trying to do?
j

Julius Marozas

09/29/2020, 1:02 PM
@flosch thanks, that's what I was looking for. @Ian Lake I have a composable that displays a real-time graph and it is quite battery intensive. So I was thinking that I could unmount the graph composable or just pause the graph temporarily when the app is in background.
2 Views