This question is for any Android developers out there.
If I try to open "untappd://brewery/nnnnn" unconditionally it correctly opens the Untappd app to the proper page.
However, since I can't guarantee that every user will have the Untappd app installed, I need to check if the app is installed.
The usual way I do that is to call query.IntentActivities on an instance of the package manager, passing an intent built from "untappd://brewery/nnnnn", eg:
List<ResolveInfo> activities = packageManager.queryIntentActivities(intent, PackageManager.MATCH_ALL);
if (activities.size() > 0) {
startActivity(intent);
} else {
//Untappd not installed, launch browser...
}
However this doesn't work. I also tried querying with the page name, which from the Play store seems to be "
com.untappdllc.app" but no joy there.
My kludgy workaround it to surround the startActivity with a try-catch but I really don't like doing that.
Does somebody have a more elegant way to tell if the Untappd app is installed.
Thanks,
Fred