Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
248 views
in Technique[技术] by (71.8m points)

android - 如何注销所有应用程序(How to logout all application)

Good day...I working with two applications, and both applications a user have to be logged in.The first application after logging in,there is a button on click of the button,it forwards the user to the second application login.

(美好的一天...我正在使用两个应用程序,并且两个应用程序都必须先登录。第一个应用程序登录后,单击该按钮后会有一个按钮,它将用户转发到第二个应用程序登录。)

So now the user is logged in two different applications.

(因此,现在用户已登录两个不同的应用程序。)

So how can i logout both application on click of a logout button.

(因此,如何在单击注销按钮时注销两个应用程序。)

I am able to logout for one application only.

(我只能注销一个应用程序。)

This is my Code to logout for an application

(这是我注销应用程序的代码)

 private void logOut() {

       mAuth.signOut();
        sendToLogin();
    }
  ask by Liam translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can register a broadcast receiver in both applications.

(您可以在两个应用程序中注册一个广播接收器。)

On clicking the logout button, you can send this logout broadcast.

(单击注销按钮后,您可以发送此注销广播。)

On receiving this logout broadcast in onreceive method of the broadcast receiver call mAuth.signOut().

(在以广播接收器的onreceive方法接收此注销广播后,调用mAuth.signOut()。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...