Skip to content

Instantly share code, notes, and snippets.

@mayuroks
Created July 10, 2018 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mayuroks/9d0a712b75c9f9c9484e552023b63247 to your computer and use it in GitHub Desktop.
Save mayuroks/9d0a712b75c9f9c9484e552023b63247 to your computer and use it in GitHub Desktop.
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