5

I have in my app a FB AuthButton that is doing the connection to FB process
I have a device that is running an old version of the FB app (version 1.8.3 - 1.8.4).

when I click on the login button, the process doesn't start the native app, but calls the browser to finish the process.
In the logs, I see those logs:

06-16 12:26:00.709: E/ActivityThread(21597): Failed to find provider info for com.facebook.katana.provider.AttributionIdProvider
06-16 12:26:03.321: E/Tab(21678): onReceivedError -10 fbconnect://success#access_token=MY_TOKEN&expires_in=5170432 The protocol is not supported.

and on the screen, the browser shows this screenshot:

FB wtf?!

any thoughts on how to fix this or ridirect back to my app?

3
  • 3rd option in this post is WebDialog implement that instead of FB auth button.
    – Mihir
    Jun 17, 2013 at 5:48
  • I know, but I don't want to force my users to go to a web dialog unless there's no other way. since in this case, the user has the app installed, (it's just not updated), and I have no way of finding out the version of his Facebook app, and no control over the login process, how can I fix that?
    – thepoosh
    Jun 17, 2013 at 6:25
  • The SDK should not go out to the Android Browser. What is the url in the browser before it redirects to the fbconnect:// url?
    – Ming Li
    Jun 17, 2013 at 19:38

1 Answer 1

5

We've found that Facebook version 1.9.8+ works, which is version code 40477+.

As we are using the deprecated Facebook.java class, we modified validateAppSignatureForPackage(). It seems to work for all versions of the facebook app now.

private boolean validateAppSignatureForPackage(Context context, String packageName) 
{
    PackageInfo packageInfo;
    try 
    {
        packageInfo = context.getPackageManager().getPackageInfo(packageName, 
                      PackageManager.GET_SIGNATURES);
        if(packageInfo.versionCode<40477)
        {
            Log.i("validateAppSignatureForPackage", 
              "Your facebook app version is prior to 1.9.8. Update your facebook app"); 
            return false;
        }
    } 
    catch (NameNotFoundException e) 
    {
        Log.i("validateAppSignatureForPackage", e.getMessage());
        return false;
    }
    catch(Exception e)
    {
        Log.i("validateAppSignatureForPackage", e.getMessage());
        return false;
    }

    for (Signature signature : packageInfo.signatures) {
        if (signature.toCharsString().equals(FB_APP_SIGNATURE)) {
            return true;
        }
    }
    return false;
}

If you want to test this yourself, you can find previous versions of the facebook app here: http://www.androiddrawer.com/2274/download-facebook-for-android-1-9-7-app-apk/#.Uctn6Zwaux4

2
  • what do you do after noticing that the version you have is not compatible with the SDK?
    – thepoosh
    Jul 2, 2013 at 10:08
  • validateAppSignatureForPackage() returns a boolean which represents whether a valid version of the facebook app is installed. By simply returning false, the sdk doesn't try to use the facebook app and instead uses FBDialog.java. That's the fix we made. I hope that answers your question.
    – cowlinator
    Jul 2, 2013 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.