Im using FB-android-SDK 3.0. While SSO, if I press back button on facebook login page(of FB app), an exception is generated. Here is the stacktrace.
01-11 22:35:07.146: E/AndroidRuntime(13076): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=64206, result=0, data=null} to activity {com.nitinbansal85.android.testfacebook1/com.facebook.LoginActivity}: java.lang.NullPointerException
01-11 22:35:07.146: E/AndroidRuntime(13076): at android.app.ActivityThread.deliverResults(ActivityThread.java:3386)
01-11 22:35:07.146: E/AndroidRuntime(13076): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3428)
01-11 22:35:07.146: E/AndroidRuntime(13076): at android.app.ActivityThread.access$2700(ActivityThread.java:125)
01-11 22:35:07.146: E/AndroidRuntime(13076): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1944)
01-11 22:35:07.146: E/AndroidRuntime(13076): at android.os.Handler.dispatchMessage(Handler.java:99)
01-11 22:35:07.146: E/AndroidRuntime(13076): at android.os.Looper.loop(Looper.java:123)
01-11 22:35:07.146: E/AndroidRuntime(13076): at android.app.ActivityThread.main(ActivityThread.java:4420)
01-11 22:35:07.146: E/AndroidRuntime(13076): at java.lang.reflect.Method.invokeNative(Native Method)
01-11 22:35:07.146: E/AndroidRuntime(13076): at java.lang.reflect.Method.invoke(Method.java:521)
01-11 22:35:07.146: E/AndroidRuntime(13076): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:924)
01-11 22:35:07.146: E/AndroidRuntime(13076): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:682)
01-11 22:35:07.146: E/AndroidRuntime(13076): at dalvik.system.NativeStart.main(Native Method)
01-11 22:35:07.146: E/AndroidRuntime(13076): Caused by: java.lang.NullPointerException
01-11 22:35:07.146: E/AndroidRuntime(13076): at com.facebook.AuthorizationClient$KatanaProxyAuthHandler.onActivityResult(AuthorizationClient.java:645)
01-11 22:35:07.146: E/AndroidRuntime(13076): at com.facebook.AuthorizationClient.onActivityResult(AuthorizationClient.java:142)
01-11 22:35:07.146: E/AndroidRuntime(13076): at com.facebook.LoginActivity.onActivityResult(LoginActivity.java:134)
01-11 22:35:07.146: E/AndroidRuntime(13076): at android.app.Activity.dispatchActivityResult(Activity.java:3828)
01-11 22:35:07.146: E/AndroidRuntime(13076): at android.app.ActivityThread.deliverResults(ActivityThread.java:3382)
I have wrapped the code that does SSO in FacebookOperationCanceledException
, but it is not thrown.
Am I missing something here?
EDIT: The app crashes!
This is a reported bug: facebook bug report
Here is my workaround:
String errorMessage = "Login cancelled!";
if(data != null && data.getStringExtra("error") != null)
{
errorMessage = data.getStringExtra("error");
}
outcome = Result.createCancelResult(errorMessage );
You do these modifications in AuthorizationClient.java in line 645
This bug is fixed in facebook-android-sdk-3.0.1. Better to download it and use it. Worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With