Created
July 10, 2018 10:53
-
-
Save mayuroks/9d0a712b75c9f9c9484e552023b63247 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BaseApplication extends Application { | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
// Observer to detect if the app is in background or foreground. | |
AppLifeCycleObserver lifeCycleObserver | |
= new AppLifeCycleObserver(getApplicationContext()); | |
// Adding the above observer to process lifecycle | |
ProcessLifecycleOwner.get() | |
.getLifecycle() | |
.addObserver(lifeCycleObserver); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment