Deferred Deep Linking URL in Android
Firebase Dynamic Links seems to be the official Android way to support the deferred deep link that will send user across the installation UI if needed. It also works with iOS and Web.
The answers and comments so far are all referring to normal deep linking. None of them will get you deferred deep linking (i.e., the ability to deep link even when the app is not installed yet and the user needs to first visit the Play Store to download it).
Vanilla iOS does not support deferred deep linking at all. Android can do it with the Android Google Play referrer, but it is unreliable and doesn't work at all from Chrome.
To do this, you'll likely want to investigate a free third-party service like Branch.io (full disclosure: I am on the Branch team). The Branch platform abstracts all the technical details and edge cases away, so all you need to worry about is defining a set of key/value parameters (for example: articleID: story123
) when you create a link. Branch makes sure those parameters are returned to you inside the app the first time it launches after the user clicks the link, whether or not the app was installed when the link was clicked. You can then use the values to route/customize however you wish.
The url comes from any app or the user. Its just a normal app in the form http://example.com/path. THe magic is that your manifest registers an intent filter for the http scheme and the example.com/path path, and Android will take any intent that has an ACTION_VIEW for that url to your app. If your app isn't installed, since its an http url it falls back to the browser. If the url happens to go or redirect to the play store, then it gets you that behavior as well.