Properly skip login activity if already logged in

后端 未结 5 1347
终归单人心
终归单人心 2021-01-31 03:55

My launcher icon currently starts the login activity. I\'ve stored the logged in status in SharedPreferences. Is there any way to properly skip the login activi

5条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-31 04:17

    In main activity just check if user is not null then fire up home

    firebaseAuth = FirebaseAuth.getInstance();
    
    FirebaseUser user = firebaseAuth.getCurrentUser();
    
    if (user != null) {
        finish();
        startActivity(new Intent(MainActivity.this, UserHomeActivity.class));
    }
    

提交回复
热议问题