Reputation: 4437
I'm using android-simple-facebook lib to make login in facebook and get some user data.
In this case the problem that I'm facing is that I can't get the user's birthdate data.
I've set the permissions to the SimpleFacebookConfiguration
object
private Permission[] permissions = new Permission[]{
Permission.EMAIL,
Permission.USER_BIRTHDAY,
Permission.PUBLIC_PROFILE,
Permission.PUBLISH_ACTION
};
and this profile's permissions to get the data
Profile.Properties properties = new Profile.Properties.Builder()
.add(Profile.Properties.ID)
.add(Profile.Properties.FIRST_NAME)
.add(Profile.Properties.LAST_NAME)
.add(Profile.Properties.BIRTHDAY)
.add(Profile.Properties.AGE_RANGE)
.add(Profile.Properties.EMAIL)
.add(Profile.Properties.GENDER)
.build();
But I can't get the data from any of them. Any idea?
Upvotes: 0
Views: 330
Reputation: 697
To request for new permission
private Permission[] permissions = new Permission[]{
Permission.EMAIL,
Permission.USER_BIRTHDAY,
};
SimpleFacebook.getInstance().requestNewPermissions(permissions, new OnNewPermissionsListener() {
@Override
public void onFail(String reason) {
//mResult.setText(reason);
System.out.println(""+reason);
}
@Override
public void onException(Throwable throwable) {
// mResult.setText(throwable.getMessage());
System.out.println(""+throwable.getMessage());
}
@Override
public void onCancel() {
}
@Override
public void onSuccess(String accessToken, List<Permission> acceptedPermissions, List<Permission> declinedPermissions) {
// showGrantedPermissions();
mSimpleFacebook.getProfile(properties, onProfileListener);
if (declinedPermissions != null && declinedPermissions.size() > 0) {
Toast.makeText(LoginActivity.this, "User declined few permissions: " + declinedPermissions.toString(), Toast.LENGTH_SHORT).show();
}
}
});
Profile.Properties properties = new Profile.Properties.Builder()
.add(Profile.Properties.ID)
.add(Profile.Properties.FIRST_NAME)
.add(Profile.Properties.LAST_NAME)
.add(Profile.Properties.BIRTHDAY)
.add(Profile.Properties.AGE_RANGE)
.add(Profile.Properties.EMAIL)
.add(Profile.Properties.GENDER)
.build();
Upvotes: 0