How to get user profile information from Facebook API Android

前端 未结 6 2086
半阙折子戏
半阙折子戏 2020-12-05 08:53

I\'m trying to get user profile information Facebook. Begins loading, I click to confirm permission to send my profile, again, continue loading but eventually get empty fiel

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-05 09:35

    First: login

    LoginManager loginManager = LoginManager.getInstance();
    loginManager.registerCallback(callbackManager, new FacebookLoginCallback());
    

    Then: get profile infomation

    // call this when login success
    Profile profile = Profile.getCurrentProfile();
    // getAvatar
    String avatar = ImageRequest.getProfilePictureUri(profile.getId(), width, height).toString();
    

提交回复
热议问题