I'm trying to create an app that can pop up a dialog any time the app returns from the background.
My app has multiple Activities and I've been trying to create a base class that checks for OnResume in the Activity. The problem is, when I switch between Activities, they fire OnResume which is not what I want, I only want the dialog to appear when the app itself resumes from the background.
I see Jetpack has Application lifecycle events which looks like exactly what I'm looking for in ProcessLifecycleOwner.
I'm trying code like this in my base activity, but now, apparently because I've loaded multiple activities my events are firing multiple times...once for each Activity/Listener.
How can I implement this so that there is only one listener but all Activities have access to the application events? I considered using the Application class as the single listener, but I'm not sure how I can then link into those events or pass that information back to my various Activities.