title: Android Deep linking: Use the same link for the app and the play store
body: <p>I have a website which enables the user to make a search query. The query might take some time to complete (minutes to days), and I would like to enable the user to download an Android app and receive the answer there, by sending an email with a link to the user.</p>
  
  <p>I would like this mechanism to work whether the user has the app installed or not; in other words:</p>
  
  <ul>
  <li>If the user has the app it should be opened with <a href="https://developer.android.com/training/app-indexing/deep-linking.html" rel="noreferrer">deep link</a> that contains an identifier argument.</li>
  <li>If the user does not have it it should open the play store on the app's page (e.g. <code>https://play.google.com/store/apps/details?id=com.bar.foo&amp;referrer=BlahBlah</code>), let the user install it, and open the app with the identifier argument.</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/yc0yS.png" alt="enter image description here"></p>
  
  <p><strong>Is there a way to form a link that opens an Android application with an argument, that would work regardless if the app is installed or not?</strong></p>