注销功能在Facebook中的Andr​​oid整合关闭 [英] Logout feature disable in Facebook android integration

查看:177
本文介绍了注销功能在Facebook中的Andr​​oid整合关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创造了与Facebook整合的SDK 4.0以上版本的Andr​​oid应用程序。我在XML实现了自定义的Andr​​oid按钮,该按钮的点击我处理的Facebook LoginButton LoginButton loginButton =(LoginButton)findViewById(R.id.login_button)的点击;和我的自定义按钮,单击我使用loginButton.performClick();并开始对registercallback功能工作。我已经成功地实施了登录的功能,但我想,我永远不会从我的应用程序退出,直到除非我preSS退出按钮。所以我从来没有想从我的应用程序注销。

请帮我青睐的是一样的。任何帮助是AP preciated。


解决方案

使用共享preferences或者你也可以检查用户存在与否。
你可以像这样在你的按钮的单击事件。

\r
\r

配置= Profile.getCurrentProfile()getCurrentProfile()。\r
如果(配置文件!= NULL){\r
//用户登录\r
    。LoginManager.getInstance()退出();\r
    \r
}其他{\r
//用户尚未登录\r
    loginButton.performClick();\r
}

\r

\r
\r

I had created an Android application with Facebook integration of SDK version 4.0+. I implemented a custom Android button in my xml and on click of that button I handle the click of Facebook LoginButton LoginButton loginButton = (LoginButton)findViewById(R.id.login_button); and on click of my custom button I use loginButton.performClick(); And start to work on registercallback function. I had successfully implemented Login feature, but I want that I never logout from my application, until and unless I press the Logout button. So I never want to logout from my application.

Please do me the favour for the same. Any help is appreciated.

解决方案

use shared preferences or you can also check user is exist or not. you can do like this on your button's click event.

profile = Profile.getCurrentProfile().getCurrentProfile();
if (profile != null) {
	// user has logged in
    LoginManager.getInstance().logOut();
    
} else {
	// user has not logged in
    loginButton.performClick();
}

这篇关于注销功能在Facebook中的Andr​​oid整合关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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