Firebase Dynamic link alternatives in React Native

shyammanek

shyam manek

Posted on August 22, 2024

Firebase Dynamic link alternatives in React Native

Deprecated: embed Firebase Dynamic Links is deprecated and should not be adopted in projects that don't already use it. The service will shut down on August 25, 2025.

basic and easy configuration of deeplinking on react native using react-navigation linking

React-Navigation

For Android

1. Configure App Links in AndroidManifest.xml

To support App Links, you need to configure your AndroidManifest.xml to handle HTTP/HTTPS URLs:

Open AndroidManifest.xml
This file is located at android/app/src/main/AndroidManifest.xml

Add Intent Filters

Update the element to include intent filters that specify the domains your app can handle:


<activity
  android:name=".MainActivity"
  android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
  android:label="@string/app_name"
  android:launchMode="singleTop"
  android:theme="@style/AppTheme">

  <!-- Handle HTTP/HTTPS URLs -->
  <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="https" android:host="www.yourdomain.com" />
  </intent-filter>
</activity>


Enter fullscreen mode Exit fullscreen mode

2. Create an Asset Links File

android requires a file hosted on your domain to verify the relationship between your app and your website. This file is called the assetlinks.json file.

Create the assetlinks.json File
The assetlinks.json file should be created and placed in the
.well-known directory on your web server. The file should be accessible at https://www.yourdomain.com/.well-known/assetlinks.json.

Example content for assetlinks.json:

[
  {
    "relation": ["delegate_permission/common.handle_all_urls"],
    "target": {
      "namespace": "android_app",
      "package_name": "com.yourappname",
      "sha256_cert_fingerprints": [
        "YOUR_CERTIFICATE_FINGERPRINT"
      ]
    }
  }
]

Enter fullscreen mode Exit fullscreen mode

"package_name": Replace with your app’s package name (e.g., com.yourappname).
"sha256_cert_fingerprints": Replace with the SHA-256 fingerprint of your app’s signing certificate.

💖 💪 🙅 🚩
shyammanek
shyam manek

Posted on August 22, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related