[英]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.