0

github中的问题

我正在使用 android-simple-facebook lib 登录 facebook 并获取一些用户数据。

在这种情况下,我面临的问题是我无法获取用户的生日数据。

SimpleFacebookConfiguration我已经设置了对象的权限

private Permission[] permissions = new Permission[]{
Permission.EMAIL,
Permission.USER_BIRTHDAY,
Permission.PUBLIC_PROFILE,
Permission.PUBLISH_ACTION
};

以及此配置文件获取数据的权限

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();

但我无法从其中任何一个那里获取数据。任何想法?

4

1 回答 1

0

请求新的许可

 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();
于 2015-09-12T03:59:30.587 回答