相关疑难解决方法(0)

Android Facebook 4.0 SDK如何获取电子邮件,出生日期和用户性别

我使用以下代码.我想要用户的出生日期,电子邮件和性别.请帮忙.如何检索这些数据?

这是我onViewCreated()在片段中的内容.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {

    // Setup TextView.
    mTextDetails = (TextView) view.findViewById(R.id.text_details);

    // Set up Login Button.
    LoginButton mButtonLogin = (LoginButton) view.findViewById(R.id.login_button);
    // setFragment only if you are using it inside a Fragment.
    mButtonLogin.setFragment(this);
    mButtonLogin.setReadPermissions("user_friends");
    mButtonLogin.setReadPermissions("public_profile");
    mButtonLogin.setReadPermissions("email");
    mButtonLogin.setReadPermissions("user_birthday");

    // Register a callback method when Login Button is Clicked.
    mButtonLogin.registerCallback(mCallbackManager, mFacebookCallback);

}
Run Code Online (Sandbox Code Playgroud)

这是我的回调方法.

private FacebookCallback<LoginResult> mFacebookCallback = new FacebookCallback<LoginResult>() {
    @Override
    public void onSuccess(LoginResult loginResult) {
        Log.d("Shreks Fragment", "onSuccess");


        Profile profile = Profile.getCurrentProfile();
        Log.d("Shreks …
Run Code Online (Sandbox Code Playgroud)

android facebook-android-sdk facebook-sdk-4.0

140
推荐指数
7
解决办法
15万
查看次数