To avoid this or to avoid connect your app to some url you can do another trick to implement this using PHP and JS.
- You must create an intent-filter on your app’s main activity like this:
<intent-filter android:label="filter_react_native">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="MyCustomScheme" android:host="MyCustomHost" />
</intent-filter>
- Create PHP file
redirect_to_app.php
which will work in case user have the app installed.
<?php
header('Location: MyCustomScheme://MyCustomHost');
- Create HTML/PHP file
check_redirect_to_app.php
which must be shown for users which didn’t install your app yet.
...
<a href="https://play.google.com/store/apps/details?id=YOUR_APP_PACKAGE_NAME">Please install the application</a>
...
<script>
location.href = '...redirect_to_app.php';
</script>
- Redirect users to
check_redirect_to_app.php
.check_redirect_to_app.php
will try to redirect toMyCustomScheme://MyCustomHost
automatically. In case it will not find such a app, it will coninue to showcheck_redirect_to_app.php
content.