gpt4 book ai didi

java - FirebaseAuth.getInstance().signOut() 不注销

转载 作者:行者123 更新时间:2023-11-29 18:30:54 25 4
gpt4 key购买 nike

我尝试从 firebase 中注销用户,但在我关闭我的应用程序并再次打开后,用户仍处于连接状态

我尝试从 firebase 中定期注销用户,但没有解决问题。我想知道是什么导致了这个问题

 logout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FirebaseAuth.getInstance().signOut();
Intent picture_intent = new Intent(Dashboard.this,LoginActivity.class);
startActivity(picture_intent );
}
});

我检查用户是否连接:

@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser currentUser = firebaseAuth.getCurrentUser();
if(currentUser != null)
{
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
int again = preferences.getInt(String.valueOf(R.string.remember_me), 0);
if(again == 0)
{
Intent i = new Intent(getApplicationContext(), PagerActivity.class);
startActivity(i);
}
else
{
Intent i = new Intent(getApplicationContext(), Dashboard.class);
startActivity(i);
}

}
}

最佳答案

我认为您正在正确注销,但是当您移动到 ​​

LoginActivity.class

在您可能需要重新登录用户的地方,您必须对登录 Activity 进行某些更改。

关于java - FirebaseAuth.getInstance().signOut() 不注销,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56337887/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com