Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find out from Xamarin if a specific App is installed in Android?

In Xamarin Android, I use implicit intents to load another app. This can be the browser or whatever. If I want to load i.e. a Facebook link, the OS allows me to choose to use a browser or specifically the Facebook App. This is also the case for a few other links where the page owners have produced an app.

Is there a way to find out if a specific app, say the Stack Overflow app, is installed on the current mobile device?

like image 881
Kat Seiko Avatar asked Oct 28 '25 14:10

Kat Seiko


1 Answers

Yep, here's a Xamarin/C# function that will tell you if a specific app (via its package name) is installed:

public bool IsAppInstalled(string packageName) {
    try {
        PackageManager.GetPackageInfo(packageName, PackageInfoFlags.Activities);
        return true;
    }
    catch (PackageManager.NameNotFoundException ex) {
        return false;
    }
}

Example call:

bool bIsAppInstalled = IsAppInstalled("com.theirdomain.someapp");
like image 131
Robert Bruce Avatar answered Oct 30 '25 03:10

Robert Bruce



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!