htcdesire 上未调用 onComplete 方法
我正在 Android 上实现 Facebook 登录工具,该工具似乎在模拟器和 Google Nexus 设备上运行正常。然而,用户似乎在 HTC Desire S 上取消了授权,因此永远不会调用 onComplete()
。我发现的唯一区别是 HTC 有一个内置的 Facebook 应用程序。这是我正在使用的代码:
private void Login(){
facebook.authorize(this,new String[] {"email"}, new Facebook.DialogListener() {
@Override
public void onComplete(Bundle values) {
Log.d("Auth","onCompleteCalled");
}
@Override
public void onFacebookError(FacebookError error) {}
@Override
public void onError(DialogError e) {}
@Override
public void onCancel() {
Log.d("Auth","Cancelled");
}
});
错误消息来自 Facebook SDK 代码的这一部分:
} else if (resultCode == Activity.RESULT_CANCELED) {
// An Android error occured.
if (data != null) {
Log.d("Facebook-authorize",
"Login failed: " + data.getStringExtra("error"));
mAuthDialogListener.onError(
new DialogError(
data.getStringExtra("error"),
data.getIntExtra("error_code", -1),
data.getStringExtra("failing_url")));
// User pressed the 'back' button.
} else {
Log.d("Facebook-authorize", "Login canceled by user."); //This is the error I get
mAuthDialogListener.onCancel();
}
I am implementing a Facebook login facility on Android which seems to work OK on the emulator and on Google Nexus device. However the authorization seems to be cancelled by the user on HTC Desire S and so the onComplete()
is never called. The only difference I found is that HTC has a built in facebook application. This is the code I am using:
private void Login(){
facebook.authorize(this,new String[] {"email"}, new Facebook.DialogListener() {
@Override
public void onComplete(Bundle values) {
Log.d("Auth","onCompleteCalled");
}
@Override
public void onFacebookError(FacebookError error) {}
@Override
public void onError(DialogError e) {}
@Override
public void onCancel() {
Log.d("Auth","Cancelled");
}
});
The error message comes from this section of Facebook SDK code:
} else if (resultCode == Activity.RESULT_CANCELED) {
// An Android error occured.
if (data != null) {
Log.d("Facebook-authorize",
"Login failed: " + data.getStringExtra("error"));
mAuthDialogListener.onError(
new DialogError(
data.getStringExtra("error"),
data.getIntExtra("error_code", -1),
data.getStringExtra("failing_url")));
// User pressed the 'back' button.
} else {
Log.d("Facebook-authorize", "Login canceled by user."); //This is the error I get
mAuthDialogListener.onCancel();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请更新您的应用程序的以下代码,它将解决您的问题。
Please Update below code of your application, it will solve your problem.