How to check if Facebook is installed Android

I am modifying my app to be able to catch if a user tries to publish without having the facebook app installed (required for SSO). Here is the code I am using:

    ApplicationInfo info = getPackageManager().
            getApplicationInfo("", 0 );
    return true;
} catch( PackageManager.NameNotFoundException e ){
    return false;

The problem is, it is always catching an error. According to the question here, I need to request the appropriate permission but I don’t know what permissions I need to request.

Is my problem a permission one or something else?

Answer is the package name for the Facebook SDK. The Facebook app’s package is com.facebook.katana.

Leave a Reply

Your email address will not be published. Required fields are marked *