Open walaagomaa18 opened 8 years ago
Profile.Properties properties = new Profile.Properties.Builder() .add(Profile.Properties.FIRST_NAME).add(Profile.Properties.GENDER) .add(Profile.Properties.EMAIL).add(Profile.Properties.LAST_NAME) .add(Profile.Properties.BIRTHDAY) .add(Profile.Properties.PICTURE) .build(); mSimpleFacebook.getProfile(properties, new OnProfileListener() { @Override public void onException(@NonNull Throwable throwable) {
} @Override public void onFail(String reason) { // TODO Auto-generated method stub } @Override public void onComplete(@NonNull Profile profile) { emailTxt.setText(profile.getEmail()); fnameTxt.setText(profile.getFirstName()); flnameTxt.setText(profile.getLastName()); String gender = profile.getGender(); } });
profile.getEmail() is always null
Make sure you have sufficient permissions before calling this. It's working for me. The email might also need to be public or viewable to you.
Profile.Properties properties = new Profile.Properties.Builder() .add(Profile.Properties.FIRST_NAME).add(Profile.Properties.GENDER) .add(Profile.Properties.EMAIL).add(Profile.Properties.LAST_NAME) .add(Profile.Properties.BIRTHDAY) .add(Profile.Properties.PICTURE) .build(); mSimpleFacebook.getProfile(properties, new OnProfileListener() { @Override public void onException(@NonNull Throwable throwable) {
profile.getEmail() is always null