title: Detecting programmatically whether an app is installed on Android
body: <p>I have registered a url scheme for my Android app (let's say myapp://host).</p>
  
  <p>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?</p>
  
  <p>in iOS, it is as easy as</p>
  
  <pre><code>[[UIApplication sharedApplication] canOpenUrl:@"myapp://"];
  </code></pre>
  
  <p>is there an equivalent in Android? (easy way)</p>
  
  <p>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)</p>
  
  <pre><code>    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;
      }
  </code></pre>
  
  <p>Thanks in advance!</p>
  
  <p>Note: This is the Android version of the same question for iOS:
  <a href="https://stackoverflow.com/questions/3808691/detecting-programmatically-whether-an-app-is-installed-on-iphone/3808757#comment16408047_3808757">Detecting programmatically whether an app is installed on iPhone</a></p>