Everything worked fine until I wanted to check what would happen if the user clicks the "Login with Facebook" button without an Internet connection.
A toast appeared saying:
Login failed. Contact the developer of this application and ask to report issue # 1118578 on Facebook.
In logcat, I have:
D / Facebook-authorize (2824): Login is canceled by the user.
I tried to get rid of this toast and display my own error message in the onCancel() method, but I cannot find a way to disable this toast. When I turned on WiFi again, single sign-on no longer works!
What could be the reason for this?
private void fbLogin() { facebook.authorize(this, new String[] { "email" }, new DialogListener() { @Override public void onComplete(Bundle values) { app.save("fb_token", facebook.getAccessToken()); app.save("fb_expire", facebook.getAccessExpires()); mAsyncRunner.request("me", new meRequestListener()); } @Override public void onFacebookError(FacebookError error) {} @Override public void onError(DialogError e) {} @Override public void onCancel() {} }); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); facebook.authorizeCallback(requestCode, resultCode, data); }
EDIT:
To answer my own question, removing android:launchMode="singleInstance" From manifest to <activity> allowed # 1118578.
However, I need android:launchMode="singleInstance" to log in to OAuth twitter, as the browser passes the data back into action using the new Intent. If I do not provide android:launchMode="singleInstance" in the manifest, a new action is launched and it does not receive the OAuth verifier.
Is there any way around this, using Facebook and Twitter accounts in the same activity? The only solution I think of is to use dummy activity for Twitter4j with singleInstance .