title: Launch App or Play Store by scanning QR code
body: <p>I have an Android app with package name like <code>my.test.app</code>. I want to generate a QR code, which:</p>
  
  <ul>
  <li>If my app is installed: Open the app</li>
  <li>If not installed yet: Open the app page in PlayStore</li>
  </ul>
  
  <p>Is there a possible way to do this, so that any Android QR scanner can handle the actions described above? I couldn't find an question/answer which realizes both... Thank you!</p>
  
  <p><strong>EDIT - What I did so far</strong>
  I added the following to my "App to open" manifest:</p>
  
  <pre><code>&lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:supportsRtl="true"
      android:theme="@style/AppTheme"
      android:exported="true" &gt;
      &lt;activity android:name=".MainActivity"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.VIEW"/&gt;
              &lt;category android:name="android.intent.category.DEFAULT"/&gt;
              &lt;category android:name="android.intent.category.BROWSABLE"/&gt;
              &lt;data android:scheme="my.test.app"/&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
    ...
  &lt;/application&gt;
  </code></pre>
  
  <p>When I generate a QR code with content <code>my.test.app://test</code> and scan it, the QR reader app shows the correct content, but won't open my app!</p>
  
  <p><strong>2nd EDIT - Tried some URLs</strong></p>
  
  <p>I just tried to set a few other URLs in my Manifest's intent-filter:</p>
  
  <ol>
  <li><code>&lt;data android:scheme="http" android:host="play.google.com" android:pathPrefix="/store/apps/details?id=my.test.app"/&gt;</code>
  
  <ul>
  <li>this asks me whether to open the URL in browser or in PlayStore, if I scan the QR code with content <code>http://play.google.com/store/apps/details?id=my.test.app</code></li>
  <li>BUT WON'T OPEN MY APP IF INSTALLED!</li>
  </ul></li>
  </ol>
  
  <p><br />
   2. <code>&lt;data android:scheme="http" android:host="myapp.com" android:pathPrefix="/barcode"/&gt;</code></p>
  
  <ul>
  <li>this opens my app when scanning the QR code <code>http://myapp.com/barcode</code>! <em>BUT</em> the problem would be, that there's no solution/target address when the app is not installed when scanning! A redirect via HTML site would be possible maybe, but I don't want to use a HTML server for this!</li>
  </ul>