登录Facebook的一个活动和其他活动注销其 [英] Login Facebook with one activity and logout it with another activity
本文介绍了登录Facebook的一个活动和其他活动注销其的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用Facebook登录与应用。我从应用程序到Facebook和注销成功登录不工作。我使用Facebook SDK 3.0,并宣布在mainifest.xml的所有权限。这里是注销按钮code。
I am using Facebook login with app. I got successful login from app to facebook and logout is not working. I am using facebook sdk 3.0 and declare all permission in mainifest.xml. Here is logout button code.
public void logoutFromFacebook() {
mAsyncRunner.logout(this, new RequestListener() {
@Override
public void onComplete(String response, Object state) {
Log.d("Logout from Facebook", response);
if (Boolean.parseBoolean(response) == true) {
runOnUiThread(new Runnable() {
@Override
public void run() {
btnFbLogin.setVisibility(View.VISIBLE);
finish();
btnFbGetProfile.setVisibility(View.INVISIBLE);
}
});
}
}
@Override
public void onIOException(IOException e, Object state) {
}
@Override
public void onFileNotFoundException(FileNotFoundException e,
Object state) {
}
@Override
public void onMalformedURLException(MalformedURLException e,
Object state) {
}
@Override
public void onFacebookError(FacebookError e, Object state) {
}
});
}
请帮助和感谢提前。
Help please and thanks in advance.
推荐答案
这个方法对我的作品
public static void LogoutFB(Context context) {
Session session = Session.getActiveSession();
if (session != null) {
if (!session.isClosed()) {
session.closeAndClearTokenInformation();
//clear your preferences if saved
}
} else {
session = new Session(context);
Session.setActiveSession(session);
session.closeAndClearTokenInformation();
//clear your preferences if saved
}
}
这篇关于登录Facebook的一个活动和其他活动注销其的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文