I'm trying to create a web page that automatically opens an Android app but only if app is installed. In case it's not it should redirect to another web page.
The app is already in production and is properly handling deep links like example://content?id=42
. The format of the link could not be changed.
1) Redirects and timeout:
window.location.replace('example://content?id=42');
setTimeout(function() {
window.location.replace = 'http://example.com/content?id=42';
}, 500);
Works fine for iOS but for Android it redirects to example://
immediately and thus gives me ERR_UNKNOWN_URL_SCHEME
. Seems to be no go for Android.
2) iframe
approach. Impossible in rencent Chrome versions. Also doesn't seem to work in Samsung browser.
3) Intents with S.browser_fallback_url
. Works well but in Chrome only. Doesn't work in Opera and Samsung browser... most probably nowhere else but Chrome 25+.
The deep link directly takes them to the relevant content inside the app. But if they don't have the app installed, it instead takes them to the right app store and asks them to download the app to view the content. Simply put, the deep linking here is 'deferred' until the application is installed by the user.
You achieve this by Deep linking in your app. First of all you need to add intent filters for incoming links. Specify the ACTION_VIEW intent action so that the intent filter can be reached from Google Search. Add one or more tags, each of which represents a URI format that resolves to the activity.
playmarket=true before processing the url. on your server check, if ? playmarket=true is present, then just redirect to your app's page in google play.
use http://example.com/content?id=42
as the link and add the intent filter to your activity in manifest
<intent-filter>
<data android:scheme="http" android:host="example.com" />
...
</intent-filter>
However, a list of app registered, e.g. browsers, will show up when the link is first accessed on the machine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With