简体   繁体   中英

Unable to get Facebook permissions: birthday_date, about_me always null

I have asked facebook for birthday_date,about_me and location permissions of user and friends, but when I query to get these fields, these are null. I have 150 friends in json all have these fields equal to null, indicating that facebook has not authenticated permisson. Query:

        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 response contains following fields null.

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

I am using following code to login and get permissions from 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 method of button is as follows.

    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());
        }
    }

Do you not need to request them using the same name as the permission? Ie it would look like this:

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";

EDIT Have you tried doing this using a Graph API call? I believe the same information can be obtained via:

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

If you'd rather not use a graph call have you tried using birthday, location, and bio in an FQL call, perhaps they changed the names of the columns?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM