@Override public void logoutUser() { editor.clear(); editor.commit(); Intent intent = new Intent(AppUtil.CONTEXT, LoginActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); AppUtil.CONTEXT.startActivity(intent); }
@Override public boolean checkLogin() { boolean isLoggedIn = isLoggedIn(); if (!isLoggedIn) { Intent intent = new Intent(AppUtil.CONTEXT, LoginActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); AppUtil.CONTEXT.startActivity(intent); } return isLoggedIn; }
private UserSessionManager() { super(); pref = AppUtil.CONTEXT.getSharedPreferences(PREF_NAME, PRIVATE_MODE); editor = pref.edit(); }