简体   繁体   中英

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

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

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