我创建了一个Android应用程序,其中包含Facebook版本4.0+的Facebook集成。我在我的xml中实现了一个自定义的Android按钮,然后单击该按钮我处理了Facebook LoginButton的点击LoginButton loginButton =(LoginButton)findViewById(R.id.login_button);然后点击我的自定义按钮我使用loginButton.performClick();并开始研究registercallback函数。我已成功实现了登录功能,但我希望我永远不会从我的应用程序注销,除非我按下“注销”按钮。所以我永远不想从我的应用程序注销。
请帮我一个忙。任何帮助表示赞赏。
答案 0 :(得分:1)
使用共享首选项或您也可以检查用户是否存在。 您可以在按钮的点击事件中执行此操作。
profile = Profile.getCurrentProfile().getCurrentProfile();
if (profile != null) {
// user has logged in
LoginManager.getInstance().logOut();
} else {
// user has not logged in
loginButton.performClick();
}