Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Facebook获得完整的用户配置文件_Android_Facebook_Facebook Graph Api - Fatal编程技术网

Android Facebook获得完整的用户配置文件

Android Facebook获得完整的用户配置文件,android,facebook,facebook-graph-api,Android,Facebook,Facebook Graph Api,我无法使用Facebook sdk获取完整的用户配置文件。我试图从Facebook的graph API中检索用户节点,该API引用了以下链接。我只收到几个字段(有点有限的个人资料) 我首先使用以下行执行登录 LoginManager.getInstance().logInWithReadPermissions(getActivity(), Arrays.asList("public_profile", "user_friends")); 一旦有了访问令牌,我就调用“/me”端点。我获

我无法使用Facebook sdk获取完整的用户配置文件。我试图从Facebook的graph API中检索用户节点,该API引用了以下链接。我只收到几个字段(有点有限的个人资料)

我首先使用以下行执行登录

    LoginManager.getInstance().logInWithReadPermissions(getActivity(), Arrays.asList("public_profile", "user_friends"));
一旦有了访问令牌,我就调用“/me”端点。我获取相应用户的Facebook用户ID。使用此ID,然后使用以下代码位调用“/{user ID}”端点

   new GraphRequest(
            AccessToken.getCurrentAccessToken(),
            "/" + userProfile.getId(),
            null,
            HttpMethod.GET,
            new GraphRequest.Callback() {
                public void onCompleted(GraphResponse response) {
                    Log.d(TAG, response.getRawResponse());
                }
            }
    ).executeAsync();
但是,返回的字段是有限的,不包含下面链接中提到的完整字段集

如何检索与用户相关的完整数据集,包括上面链接中提到的朋友列表、年龄等?

我只能找回
id、电子邮件、名字、性别、姓氏、链接、区域设置、姓名、时区和当前已验证的字段。

我找到了检索所需字段或特定字段的方法。默认情况下,不会返回特定节点中的所有字段。您需要通过将它们作为参数传递来指定它们,如下所示

GraphRequest graphRequest = new GraphRequest(
            AccessToken.getCurrentAccessToken(),
            "/me",
            null,
            HttpMethod.GET,
            new GraphRequest.Callback() {
                public void onCompleted(GraphResponse response) {
                    Log.d(TAG, response.getRawResponse());


                }
            }
    );
    Bundle parameters = new Bundle();
    parameters.putString("fields", "id,email,first_name,gender,last_name,link,locale,name,timezone,updated_time,verified,age_range,friends");
    graphRequest.setParameters(parameters);
    graphRequest.executeAsync();