I got an app with tabs and a notification bar entry, when I send it to background (click on home button) and try to re-open the application via click on the notification ba
public static boolean isApplicationRunningBackground(final Context context) {
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List tasks = am.getRunningTasks(am.getRunningAppProcesses().size());
for (RunningTaskInfo runningTaskInfo : tasks) {
if (runningTaskInfo.topActivity.getPackageName().equals(context.getPackageName())) {
MyLog.i("UTIL", "packageName:" + runningTaskInfo.topActivity.getPackageName());
MyLog.i("UTIL", "className" + runningTaskInfo.topActivity.getClassName());
return true;
}
}
return false;
}
Intent notificationIntent;
if (Util.isApplicationRunningBackground(context)) {
notificationIntent = new Intent(context, MainView.class);
} else {
notificationIntent = new Intent(context, Splash.class);
}