0

I am using the following code. I want the user's public profile

This is my getUserProfile() to get the details from profile I have only set default permission

private void getUserProfile(AccessToken currentAccessToken) {
  GraphRequest request = GraphRequest.newMeRequest(
    currentAccessToken, new GraphRequest.GraphJSONObjectCallback() {
      @Override
      public void onCompleted(JSONObject object, GraphResponse response) {
        Log.d("TAG", object.toString());
        try {
          String first_name = object.getString("first_name");
          String last_name = object.getString("last_name");
          String email = object.getString("email");
          String id = object.getString("id");
          String image_url = "https://graph.facebook.com/" + id + "/picture?type=normal";

          appData.setEmail(email);
          appData.setUsername(first_name + " " + last_name);
          appData.setGoogleID(id);
          appData.setProfile(image_url);

          loginPresenter.signInThroughSocialMedia(first_name + " " + last_name, email, id);

        } catch (JSONException e) {
          e.printStackTrace();
        }

      }
    });

  Bundle parameters = new Bundle();
  parameters.putString("fields", "first_name,last_name,email,id");
  request.setParameters(parameters);
  request.executeAsync();
}
4

0 回答 0