I have registered a url scheme for my Android app (let's say myapp://host).
On my other app, I can launch that app by using Intent, but how do I check whether the first app is installed without launching it?
in iOS, it is as easy as
[[UIApplication sharedApplication] canOpenUrl:@"myapp://"];
is there an equivalent in Android? (easy way)
I'd like to check using url scheme. I know how to check using package name, but I do not know how to get the url scheme from PackageInfo as well... (harder way)
PackageManager pm = m_cContext.getPackageManager();
boolean installed = false;
try {
@SuppressWarnings("unused")
PackageInfo pInfo = pm.getPackageInfo(szPackageName, PackageManager.GET_ACTIVITIES);
installed = true;
}
catch (PackageManager.NameNotFoundException e) {
installed = false;
}
Thanks in advance!
Note: This is the Android version of the same question for iOS: Detecting programmatically whether an app is installed on iPhone