Rahul Wadhai
Rahul Wadhai

Reputation: 423

Using Facebook Api birthday return null In android

In Android App Integrated Facebook Api. I am using Facebook sdk:4.21.0,But when GraphRequest Call birthday not return in Json Response. Please let me know whats wrong. I am also tested through give the public permission to date of birth of user.

GraphRequest request = GraphRequest.newMeRequest(
                AccessToken.getCurrentAccessToken(),
                new GraphRequest.GraphJSONObjectCallback() {
                    @Override
                    public void onCompleted(JSONObject object, GraphResponse response) {
                        LogUtils.logE(TAG, "JsonResponse: " + object);

                    }
                });
        Bundle parameters = new Bundle();
        parameters.putString("fields", "id,name,birthday,picture.type(large)");
        request.setParameters(parameters);
        request.executeAsync();

Upvotes: 0

Views: 381

Answers (1)

rafsanahmad007
rafsanahmad007

Reputation: 23881

Add the user_birthday parameter in your logInWithReadPermissions() method

 LoginManager.getInstance().logInWithReadPermissions(MyProfil‌​eActivity.this, Collections.singletonList("public_profile", "email", "user_birthday", "user_friends"));

OR

loginButton = (LoginButton) findViewById(R.id.login_button);
loginButton.setReadPermissions(Arrays.asList(
                "public_profile", "email", "user_birthday", "user_friends"));

Upvotes: 1

Related Questions