来自谷歌和Facebook的Andr​​oid应用程序注销 [英] Sign out from google and facebook in android application

查看:102
本文介绍了来自谷歌和Facebook的Andr​​oid应用程序注销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将谷歌和Facebook注册使用他们各自的方法。但是,成功签约后,我想开不同的活动,同样用户可以到各种不同的活动。我已经用行动酒吧,在那里我给一个选项,无论从用户已登录的账户注销。我怎么能注销的用户,当我在不同的活动则主要活动。我得到一个例外,我不能够通过apiclient引用(谷歌)和会话引用(脸谱)到另一个活动。请帮忙。 先谢谢了。

I have integrated google and facebook sign up using their respective methods. But after successful signing, I want to open different activity and similarly user can go to various different activities. I have used action bar where I am giving an option to sign out from either of the account that the user has logged in. How could I sign out the user when I am in different activity then the main activity. I am getting an exception and I am not able to pass apiclient reference (for google) and session reference (for facebook) to another activity. Please help. Thanks in advance.

推荐答案

只需添加上新的活动内容:

just add on your new activity this:

 @Override
        protected void onStart() {
            mGoogleApiClient.connect();
            super.onStart();
        }

然后

@Override
    public void onClick(View v)  {
            switch (v.getId()) {
                case R.id.sign_out_button2:

                        Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
                        mGoogleApiClient.disconnect();
                        mGoogleApiClient.connect();

这篇关于来自谷歌和Facebook的Andr​​oid应用程序注销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆