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

标签 java android firebase firebase-authentication

我尝试从 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/

相关文章:

Java NumberFormatException?

java - 使用递归/辅助函数计算链表的大小 - Java

java - 如何在 API 23+ 中解析 setLatestEventInfo

Android:将设备USB插入/拔出USB端口时的BroadcastReceiver

Java:读取特定格式的字符串

android - 自动滚动 Web View

node.js - 在不知道 firebase 和 firebase-admin 中的 key 的情况下如何获得快照的子级

android - 云 Firestore : retrieving cached data via direct get?

firebase - Firebase Cloud Function 中忽略了 4GB 的内存分配

java - 是否可以在非捕获组上使用量词? - 正则表达式