无法获得Facebook权限:birthday_date,about_me始终为null

时间:2012-02-01 20:29:37

标签: android facebook-fql

我已经向facebook询问了birthday_date,about_me以及用户和朋友的位置权限,但是当我查询获取这些字段时,这些字段为空。我在json有150个朋友都有这些字段等于null,表明facebook没有经过身份验证。 查询:

        String query = "select name,about_me,birthday_date, current_location, uid, pic_square,sex from user where uid in (select uid2 from friend where uid1=me()) order by name";
        Bundle params = new Bundle();
        params.putString("method", "fql.query");
        params.putString("query", query);
        response = Utility.mFacebook.request(null, params, "GET");

Json响应包含以下字段null。

"birthday_date": null,
"current_location": null,
"about_me": null,

我正在使用以下代码登录并从Facebook获取权限。

    Utility.mFacebook = new Facebook(Constants.MY_APP_ID);
    Utility.mAsyncRunner = new AsyncFacebookRunner(Utility.mFacebook);

    SessionStore.restore(Utility.mFacebook, this);
    SessionEvents.addAuthListener(new SampleAuthListener());
    SessionEvents.addLogoutListener(new SampleLogoutListener());
    String permissions[]=new String[]{"user_about_me","friends_about_me","user_birthday",
            "friends_birthday","user_location","friends_location","offline_access"};
    mLoginButton.init(this, Utility.mFacebook,permissions);

按钮的onClick方法如下。

    public void onClick(View arg0) {
        if (mFb.isSessionValid()) {
            SessionEvents.onLogoutBegin();
            AsyncFacebookRunner asyncRunner = new AsyncFacebookRunner(mFb);
            asyncRunner.logout(getContext(), new LogoutRequestListener());
        } else {
            mFb.authorize(mActivity, mPermissions,Facebook.FORCE_DIALOG_AUTH,
                          new LoginDialogListener());
        }
    }

1 个答案:

答案 0 :(得分:0)

您是否需要使用与权限相同的名称请求它们?即它看起来像这样:

String query = "select name, user_about_me, user_birthday, user_location, uid, pic_square, sex from user where uid in (select uid2 from friend where uid1=me()) order by name";

修改 您是否尝试过使用Graph API调用?我相信可以通过以下方式获得相同的信息:

https://graph.facebook.com/<fb_id>?fields=birthday,location,bio&access_token=<user_access_token>

如果您不想使用图表调用,您是否尝试在FQL调用中使用birthday,location和bio,或许他们更改了列的名称?