使用Facebook Api生日返回null在android中 [英] Using Facebook Api birthday return null In android

查看:191
本文介绍了使用Facebook Api生日返回null在android中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android App中整合Facebook Api。我正在使用Facebook sdk:4.21.0,但是当GraphRequest调用生日时没有返回Json Response。请让我知道什么是错的。我也通过公开允许用户出生日期进行测试。

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


推荐答案

添加 user_birthday 中的code>参数logInWithReadPermissions()方法

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

这篇关于使用Facebook Api生日返回null在android中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆