Oct 6, 2012

Android Facebook SDK login error #1118578

The error is caused because the activity has set the launch mode to singleInstance.

From StackOverflow where I posted the question:


Everything was working fine, until I wanted to check what happens if the user clicks the Login with Facebook button with no internet connection available.
A toast showed up saying:
Login failed. Please contact the maker of this app and ask them to report issue #1118578 to Facebook.
In the logcat I have:
D/Facebook-authorize(2824): Login canceled by user.
I tried to get rid of this toast and display my own error message in the onCancel() method - but I can't find a way to disable that toast. When I enabled WiFi again, single sign on didn't work anymore!
What could be the cause of 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 the manifest in the  resolved the #1118578 issue.
However, I do need the android:launchMode="singleInstance" for the twitter OAuth login, as the browser passes the data back to the activity via new Intent. If I do not provideandroid:launchMode="singleInstance" in the manifest, a new activity is launched and it does not recieve the OAuth verifier.
Is there any way around this, to use Facebook and Twitter login in the same activity? The only solution I think of is to use a dummy activity for Twitter4j with singleInstance.


See original thread here:
http://stackoverflow.com/questions/12759261/android-facebook-sdk-login-error-1118578

No comments: