0
if (!facebook.isSessionValid()) {
            Log.i("FacebokLogin ", "facebook session not valid");
            facebook.authorize(FacebookUtility.this, new String[] {}, new DialogListener() {
                @Override
                public void onComplete(Bundle values) {

                    SharedPreferences.Editor editor = mPrefs.edit();
                    editor.putString("FBLaccess_token",
                            facebook.getAccessToken());
                    editor.putLong("FBLaccess_expires",
                            facebook.getAccessExpires());
                    editor.commit();
                    Log.i("FacebokLogin ", "onComplete, values: " + values);
                    shareOnFacebook();
                }   

 mFacebook.dialog(FacebookUtility.this, "feed", parameters, new UpdateStatusListener());

授权完成并执行 mFacebook.dialog () 后,它会询问用户名和密码并显示提要对话框,但用户已经使用 facebook 应用程序登录。可能是什么问题?我正在测试 android 4.0 htc 欲望 c

4

1 回答 1

1

尝试这个

if (!facebook.isSessionValid()) {
    facebook.authorize(this,
            new String[] { "email", "publish_stream" },
            new DialogListener() {

                @Override
                public void onCancel() {
                    // Function to handle cancel event
                }

                @Override
                public void onComplete(Bundle values) {
                    // Function to handle complete event
                    // Edit Preferences and update facebook acess_token
                    SharedPreferences.Editor editor = mPrefs.edit();
                    editor.putString("access_token",
                            facebook.getAccessToken());
                    editor.putLong("access_expires",
                            facebook.getAccessExpires());
                    editor.commit();
                }
于 2012-10-10T15:06:19.873 回答