Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
123 views
in Technique[技术] by (71.8m points)

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:

try{
    ApplicationInfo info = getPackageManager().
            getApplicationInfo("com.facebook.android", 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

com.facebook.android is the package name for the Facebook SDK. The Facebook app's package is com.facebook.katana.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...