I have an app where I want to build 2 different flow\'s in:
1.b App show\'s an alertbox where user can choose to go to
Make a class extends Application and implement ActivityLifecycleCallbacks and according to on pause and onResume update a public boolean.
At the time push received check this Boolean and perform as your requirement.
Hope this will help you
public class TestApplication extends Application implements ActivityLifecycleCallbacks{
boolean applicationOnPause = false;
@Override
public void onCreate() {
super.onCreate();
registerActivityLifecycleCallbacks(this);
}
@Override
public void onActivityCreated(Activity arg0, Bundle arg1) {
Log.e("","onActivityCreated");
}
@Override
public void onActivityDestroyed(Activity activity) {
Log.e("","onActivityDestroyed ");
}
@Override
public void onActivityPaused(Activity activity) {
applicationOnPause = true;
Log.e("","onActivityPaused "+activity.getClass());
}
@Override
public void onActivityResumed(Activity activity) {
applicationOnPause = false;
Log.e("","onActivityResumed "+activity.getClass());
}
@Override
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
Log.e("","onActivitySaveInstanceState");
}
@Override
public void onActivityStarted(Activity activity) {
Log.e("","onActivityStarted");
}
@Override
public void onActivityStopped(Activity activity) {
Log.e("","onActivityStopped");
}
}