Using Facebook Api birthday return null In android

扶醉桌前 提交于 2020-01-17 09:12:40

问题


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

回答1:


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


来源:https://stackoverflow.com/questions/43290643/using-facebook-api-birthday-return-null-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!