public class Home extends AppCompatActivity {
SharedPreferences mPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
mPreferences = getSharedPreferences("com.example.example", MODE_PRIVATE);
Parse.initialize(new Parse.Configuration.Builder(this)
.applicationId("appid")
.clientKey("clientkey")
.server("https://parseapi.back4app.com/")
.build());
checkFirstRun();
if (!isUserLoggedIn()) {
startActivity(new Intent(this, Authentication.class));
finish();
} else {
checkValidSession();
}
}
private void checkFirstRun() {
if (mPreferences.getBoolean("isFirstRun", true)) {
mPreferences.edit().putBoolean("isFirstRun", false).apply();
startActivity(new Intent(this, Introduction.class));
finish();
}
}
private boolean isUserLoggedIn() {
ParseUser currentUser = ParseUser.getCurrentUser();
return currentUser != null;
}
private void checkValidSession() {
}