Android facebook sdk login error 1118578

android, facebook

Solution

My way to overcome this has been by changing the callback in twitter, from "twitter://callback" to "http://localhost/callback" and remove the android:launchMode="singleInstance" and the twitter intent-filter from the manifest.

I can still get the response in the WebView (rather than on the onResume() as before):

yourwebview.setWebViewClient(new WebViewClient() {
  @Override
  public void onPageFinished(WebView view, String url) {
    // your_callback == http://localhost/callback
    if(url == null || !url.startsWith(your_callback))
      return;

    Uri         uri = Uri.parse(url);
    String      ov  = uri.getQueryParameter("oauth_verifier");
    AccessToken at  = null;
    ...

Problem

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 `<activity>` 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 provide `android: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`.

Original source