繁体   English   中英

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

[英]How to add permission for getting birthday from 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(); //单击按钮时调用此函数

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM