Facebook的会议取消对话框 [英] Facebook Session cancel dialog
问题描述
我的深化发展,使用此应用程式:的https://developers.facebook .COM /文档/安卓/本地登录/
I'm developping an app that uses this : https://developers.facebook.com/docs/android/native-login/
我按照Facebook的开发教程,所以基本上我有会话检查,它会打开的对话框中,和我想要得到取消事件(当用户取消对话框Facebook的),但我对此没有方法
I have followed the Facebook dev tutorial, so basically I have the session check, it opens the dialog, and I'm trying to get the Cancel event (when the user cancel the facebook dialog) but I have no method on this.
也许能帮到你。
感谢
编辑:其实,即使我点击取消按钮,我还是正确接收到GraphUser。这是奇怪的。
Actually, even if I click the cancel button, I still receive the GraphUser correctly. That's weird.
推荐答案
使用的Android SDK 3.5,我得到了通过异常取消的事件,如果状态更改回调与FacebookOperationCanceledException或FacebookAuthorizationException实例,它的取消事件:
With Android SDK 3.5, I got the cancel event via exception, if the state change callback with instance of FacebookOperationCanceledException or FacebookAuthorizationException, its an cancel event:
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
if (exception instanceof FacebookOperationCanceledException || exception instanceof FacebookAuthorizationException) {
// Cancelled by user, show alert
new AlertDialog.Builder(this).setTitle(R.string.cancelled).setMessage(R.string.permission_not_granted).setPositiveButton(R.string.ok, null).show();
} else {
Session session = Session.getActiveSession();
if ((session != null && session.isOpened())) {
// Session ready
}
}
}
private Session.StatusCallback callback = new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state, Exception exception) {
onSessionStateChange(session, state, exception);
}
};
它的工作好了。
这篇关于Facebook的会议取消对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!