正如我发现的那样,它是一个firebase错误,元数据因为差异而无法工作(一些秒或者是化学的)。仍然测试所有情况,但下面的代码看起来它的工作原理,而不必用其他错误的代码替换它:
mAuthListner = new FirebaseAuth.AuthStateListener() { @Override public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { if (firebaseAuth.getCurrentUser() != null) { FirebaseUserMetadata metadata = mAuth.getCurrentUser().getMetadata(); **if (Math.abs(metadata.getCreationTimestamp() - metadata.getLastSignInTimestamp()) <5000L){** if (prefManager.isFirstTimeLaunch()) { startActivity(new Intent(MainActivity.this, NewUserActivity.class)); } else{ startActivity(new Intent(MainActivity.this, UserProfile.class)); finishAffinity(); } } else{ startActivity(new Intent(MainActivity.this, UserProfile.class)); finishAffinity(); } } } };
希望能帮助到你!!!