Facebook退出不起作用

时间:2013-08-20 06:18:58

标签: android facebook logout

我正在使用Facebook整合的Android应用程序中工作,但是每当我尝试注销Facebook时都没有完全注销,我就会遇到问题,

我搜索了很多,最后我使用了以下代码:

public Facebook mFacebook = new Facebook(APP_ID);
SessionStore.clear(logoutActivity.this);

try {
    mFacebook.logout(logoutActivity.this);
} catch (MalformedURLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

我尝试了上面的代码,但根本没有工作,Facebook没有完全注销。有人可以帮帮我吗?

1 个答案:

答案 0 :(得分:0)

今年五月对你有帮助......

Activity.mAsyncRunner.logout(this, new RequestListener() {
            public void onComplete(String response, Object state) {
                Log.d("Logout from Facebook", response);
                if (Boolean.parseBoolean(response) == true) {
                    // User successfully Logged out
                                Toast.makeText(getApplicationContext(), "Successfully logged out ", Toast.LENGTH_LONG).show();
                }
            } 
            public void onIOException(IOException e, Object state) {
            }               
            public void onFileNotFoundException(FileNotFoundException e,
                    Object state) {
            }

                public void onMalformedURLException(MalformedURLException e,
                        Object state) {
                }

                public void onFacebookError(FacebookError e, Object state) {
                }
            });

以下示例url

http://www.androidhive.info/2012/03/android-facebook-connect-tutorial/