如何添加从Facebook获得生日的权限



我无法添加生日的权限,请帮助我...提前致谢。

示例源代码是:

Session.openActiveSession(this, true, new Session.StatusCallback() {
        // callback when session changes state
        @SuppressWarnings("deprecation")
        @Override
        public void call(Session session, SessionState state,
                Exception exception) {
            if (session.isOpened()) {
                // make request to the /me API
                Request.executeMeRequestAsync(session,
                        new Request.GraphUserCallback() {
                            // callback after Graph API response with user
                            // object
                            @Override
                            public void onCompleted(GraphUser user,
                                    Response response) {
                                if (user != null) {

                                }
                            }
                        });
            } 
        }
    });

尝试这个,

.setPermissions(Arrays.asList("user_birthday","email"))

私有静态最终列表permissions = arrays.aslist(" user_birthday");//声明

onclickPostStatUsupDate();//按钮单击此功能

private void onclickpoststatusupdate(){

    performPublish(PendingAction.POST_STATUS_UPDATE);

}

私人void performpublish(pendingAction action){

    Session session = Session.getActiveSession();
    if (session != null) {
        pendingAction = action;
        if (hasPublishPermission()) {
            // We can do the action right away.
            handlePendingAction();
        } else {
            // We need to get new permissions, then complete the action when we get called back.
            session.requestNewPublishPermissions(new Session.NewPermissionsRequest(this, PERMISSIONS));
        }
    }
}
user.getBirthday();

我要使用它并将其存储为字符串。

最新更新