I solve this issues by using life cycle differences.
if home button touched onStop() is called, but if app is closed both onStop() and onDestroy() get called which means if task is killed when it's in background onDestroy() isn't called. I keep track of this scenario via sharedPreferences.
@Override
protected void onStop() {
SharedPreferencesUtilities.putBoolean("isFromOnStop", true);
super.onStop();
}
@Override
protected void onDestroy() {
SharedPreferencesUtilities.putBoolean("isFromOnStop", false);
super.onDestroy();
android.os.Process.killProcess(android.os.Process.myPid());
}
Then in onCreate() i checked this sharedPreferences boolean ;
if(SharedPreferencesUtilities.getBoolean("isFromOnStop", false)) {
SharedPreferencesUtilities.putBoolean("isFromOnStop", false);
((MainFragmentActivity)mContext).finish();
Toast.makeText(mContext, "Ooops app was killed in background", Toast.LENGTH_SHORT).show();
}