I tried to follow this https://stackoverflow.com/a/52217644/18210851 but this method ProcessLifecycleOwner.get().getLifecycle().addObserver(this) is deprecated and requires deprecated gradle dependency. Is there a way I can call some method only once when the application comes foreground.
Asked
Active
Viewed 82 times
1
-
[The Jetpack edition of `ProcessLifecycleOwner`](https://developer.android.com/reference/kotlin/androidx/lifecycle/ProcessLifecycleOwner) is not deprecated. – CommonsWare May 11 '22 at 11:21
-
@CommonsWare Could you please let me know about the gradle dependency it requires? – shweta May 11 '22 at 12:07
-
Today, use `implementation "androidx.lifecycle:lifecycle-process:2.4.1"`. – CommonsWare May 11 '22 at 12:08