我想向我的应用添加邮件权限。
我见过很多帖子,但没有人真正符合我的问题...
我使用以下代码:
Session.openActiveSession(InscriptionConnexionActivity.this, true, new Session.StatusCallback() {
// callback when session changes state
@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) {
System.out.println(user.getName() + " : connected");
register_facebook(session.getAccessToken());
}
}
});
}
} });
拥有邮件权限需要做什么?在此先感谢:)
答案 0 :(得分:1)
尝试以下代码: -
Session session = Session.getActiveSession();
if (session == null) {
session = new Session(this);
Session.setActiveSession(session);
}
if (!session.isOpened() && !session.isClosed())) {
session.openForRead(new Session.OpenRequest(this)
.setPermissions(Arrays.asList("basic_info","email"))
.setCallback(statusCallback));
}
见下面的链接