I need a callback which is fired whenever user either switches the app and comes back, or if they lock the device and then unlock it. I can't use onPause and onResume since it would be fired even if the user navigates to another activity and comes back, which is not required.
Ideally onResume would work if I had a single activity architecture, but since I have multiple activities, it fires even when I return from another activity.
I can't use onPause and onResume since it would be fired even if the user navigates to another activity and comes back, which is not required.
I ended up creating a custom ActivityLifecycleCallbacks listener, and then registering it in my Application's
onCreatemethod.MyApp.kt