Estou usando o seguinte código. Quero a data de nascimento, email e sexo do usuário. Por favor ajude. Como recuperar esses dados?
Este é o meu onViewCreated()
interior do fragmento.
@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);
}
Este é o meu método de retorno de chamada.
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 Fragment onSuccess", "" +profile);
// Get User Name
mTextDetails.setText(profile.getName() + "");
}
@Override
public void onCancel() {
Log.d("Shreks Fragmnt", "onCancel");
}
@Override
public void onError(FacebookException e) {
Log.d("Shreks Fragment", "onError " + e);
}
};