Android Facebook get all profile information

后端 未结 4 1257
暗喜
暗喜 2021-02-05 21:17

How i can fetch all of user profile information from facebook (like first name, last name, email etc.)

I have downloaded the FB SDK but there is no example for getting t

4条回答
  •  逝去的感伤
    2021-02-05 21:45

    // Make an API call to get user data and define a 
    // new callback to handle the response.
    Request request = Request.newMeRequest(session, 
            new Request.GraphUserCallback() {
        @Override
        public void onCompleted(GraphUser user, Response response) {
            // If the response is successful
            if (session == Session.getActiveSession()) {
                if (user != null) {
                    // Set the id for the ProfilePictureView
                    // view that in turn displays the profile picture.
                    profilePictureView.setProfileId(user.getId());
                    // Set the Textview's text to the user's name.
                    userNameView.setText(user.getName());
                }
            }
            if (response.getError() != null) {
                // Handle errors, will do so later.
            }
        }
    });
    request.executeAsync();
    

    This just gets the user data! You can find all corresponding details according to the 1st answer which links to a FB doc which has all the related fields that can be retrieved!

提交回复
热议问题