使用android的ParseFaceBookUtil不提供用户信息

使用android的ParseFaceBookUtil不提供用户信息,android,facebook,parse-platform,Android,Facebook,Parse Platform,我正在为我的android应用程序使用Facebook SDK。我使用了来自该网站的parse sdk代码,下面给出了一些代码片段,它已成功登录facebook,但我无法提取我的facebook信息,如:MyProfileImage、用户名等 在应用程序类中: ParseFacebookUtils.initialize(this); 在我使用Facebook登录的班级中: ParseFacebookUtils.logInWithReadPermissionsInBackground(SignI

我正在为我的android应用程序使用Facebook SDK。我使用了来自该网站的parse sdk代码,下面给出了一些代码片段,它已成功登录facebook,但我无法提取我的facebook信息,如:MyProfileImage、用户名等

在应用程序类中:

ParseFacebookUtils.initialize(this);
在我使用Facebook登录的班级中:

ParseFacebookUtils.logInWithReadPermissionsInBackground(SignInActivity.this, Arrays.asList("email", "user_photos", "public_profile", "user_friends"), new LogInCallback() {
                    @Override
                    public void done(ParseUser user, com.parse.ParseException e) {
                        if (user == null) {
                            Log.d("MyApp", "Uh oh. The user cancelled the Facebook login.");
                        } else if (user.isNew()) {
                           }
);

请帮我提取用户名和配置文件图像的信息。非常感谢

这对我来说很有用

public static void FaceBookLogin(final Activity context){
     ArrayList permissions=new ArrayList<String>();
    //permissions.add("publish_stream");
    permissions.add("user_likes");
    permissions.add("email");
    permissions.add("user_birthday");
    ParseFacebookUtils.logInWithReadPermissionsInBackground(context, permissions, new LogInCallback() {
        @Override
        public void done(ParseUser user, ParseException err) {
            if (user == null) {
                Toast.makeText(context,"You have cancelled to connect via facebook",Toast.LENGTH_SHORT);
                Log.d("MyApp", "Uh oh. The user cancelled the Facebook login.");
            } else if (user.isNew()) {
                Toast.makeText(context,"You have successfully connected via facebook",Toast.LENGTH_SHORT);
                Log.d("MyApp", "User signed up and logged in through Facebook!");
                try {
                    GraphRequest request = GraphRequest.newMeRequest(AccessToken.getCurrentAccessToken(), new GraphRequest.GraphJSONObjectCallback() {
                        @Override
                        public void onCompleted(JSONObject json, GraphResponse response) {
                            // Application code
                            if (response.getError() != null) {
                                System.out.println("ERROR");
                            } else {
                                System.out.println("Success");
                                String jsonresult = String.valueOf(json);
                                System.out.println("JSON Result" + jsonresult);

                                String fbUserId = json.optString("id");
                                String fbUserFirstName = json.optString("name");
                                String fbUserEmail = json.optString("email");
                                String fbUserProfilePics = "http://graph.facebook.com/" + fbUserId + "/picture?type=large";
                                ParseUser.getCurrentUser().setEmail(fbUserEmail);
                                ParseUser.getCurrentUser().put("First_Name",fbUserFirstName);
                                ParseUser.getCurrentUser().put("FaceBookUrl",fbUserProfilePics);
                                ParseUser.getCurrentUser().saveInBackground();
                            }
                            Log.v("FaceBook Response :", response.toString());
                        }
                    });
                    Bundle parameters = new Bundle();
                    parameters.putString("fields", "id,name,email,gender, birthday");
                    request.setParameters(parameters);
                    request.executeAsync();
                } catch (Exception e) {
                    e.printStackTrace();
                    Toast.makeText(context,e.getMessage(),Toast.LENGTH_SHORT);
                }

                if (ParseUser.getCurrentUser().getBoolean("IsTermsAccepted")==true){
                    Intent intent = new Intent(context, MainActivity.class);
                    context.startActivity(intent);
                }else{
                    Utils.ShowTermsofUse(context);
                }
            } else {
                Toast.makeText(context,"You have successfully connected via facebook",Toast.LENGTH_SHORT);
                Log.d("MyApp", "User logged in through Facebook!");
                try {
                    GraphRequest request = GraphRequest.newMeRequest(AccessToken.getCurrentAccessToken(), new GraphRequest.GraphJSONObjectCallback() {
                        @Override
                        public void onCompleted(JSONObject json, GraphResponse response) {
                            // Application code
                            if (response.getError() != null) {
                                System.out.println("ERROR");
                            } else {
                                System.out.println("Success");
                                String jsonresult = String.valueOf(json);
                                System.out.println("JSON Result" + jsonresult);

                                String fbUserId = json.optString("id");
                                String fbUserFirstName = json.optString("name");
                                String fbUserEmail = json.optString("email");
                                String fbUserProfilePics = "http://graph.facebook.com/" + fbUserId + "/picture?type=large";
                                ParseUser.getCurrentUser().setEmail(fbUserEmail);
                                ParseUser.getCurrentUser().put("First_Name",fbUserFirstName);
                                ParseUser.getCurrentUser().put("FaceBookUrl",fbUserProfilePics);
                                ParseUser.getCurrentUser().saveInBackground();
                            }
                            Log.v("FaceBook Response :", response.toString());
                        }
                    });
                    Bundle parameters = new Bundle();
                    parameters.putString("fields", "id,name,email,gender, birthday");
                    request.setParameters(parameters);
                    request.executeAsync();
                } catch (Exception e) {
                    e.printStackTrace();
                    Toast.makeText(context,e.getMessage(),Toast.LENGTH_SHORT);

                }

                if (ParseUser.getCurrentUser().getBoolean("IsTermsAccepted")==true){
                    Intent intent = new Intent(context, MainActivity.class);
                    context.startActivity(intent);
                }else{
                    Utils.ShowTermsofUse(context);
                }
            }
            Toast.makeText(context,err.getMessage(),Toast.LENGTH_SHORT);
        }
    }) ;
}

希望这有帮助

@Android\u Zapier您找到问题的解决方案了吗?
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    case FACEBOOK:
            ParseFacebookUtils.onActivityResult(FACEBOOK, resultCode, data);
            break;
    }