Deep Linking

This guide covers deep linking into video calls, extracting call IDs from URLs, and starting calls directly.

Step 1 - Native Setup

Prerequisites before following this guide is having an application with our Stream Video SDK integrated. You can follow our tutorials for the same to get started with an application.

Follow this guide for Android deep linking setup.

Creating Intent Filters

Add intent filters to AndroidManifest.xml at /android/app/src/main/AndroidManifest.xml:

  • action - ACTION_VIEW for Google Search reachability
<action android:name="android.intent.action.VIEW" />
  • data - URI format tags with android:scheme attribute minimum
<data android:scheme="http" />
<data android:scheme="https" />
<!-- The URL here must exclude the scheme -->
<data android:host="`YOUR URL HERE`" />
  • category - DEFAULT and BROWSABLE required for browser link resolution
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

Complete intent filter:

<intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="http" />
    <data android:scheme="https" />
    <!-- Example: "stream-calls-dogfood.vercel.app” -->
    <data android:host="`YOUR URL HERE`" />
</intent-filter>

Adding Asset Links

Android App Links use Digital Asset Links API for automatic URL-to-app routing without user selection.

Verification steps:

  1. Add autoVerify attribute to intent filters (as shown above)

  2. Declare association by hosting Digital Asset Links JSON at:

https://domain.name/.well-known/assetlinks.json

Generate assetlink.json using this tool:

  • Hosting site name - Deep linking URL
  • App package name - Found in MainActivity.java package declaration
  • App package fingerprint (SHA256) - See this guide

Step 2 - Using the Linking API

Use React Native's Linking API:

  • App not open - Use getInitialURL() to get initial URL
  • App open - Listen via addEventListener('url', callback)

Example:

const App = () => {
  useEffect(() => {
    const parseAndSetCallID = (url: string | null) => {
      const matchResponse = url?.match(`YOUR REGEX HERE`); // To match the paths and handle them accordingly
      if (matchResponse?.length) {
        // Your custom setup here.
      }
    };
    const { remove } = Linking.addEventListener("url", ({ url }) => {
      parseAndSetCallID(url);
    });
    const configure = async () => {
      const url = await Linking.getInitialURL();
      parseAndSetCallID(url);
    };
    configure();
    return remove;
  }, []);
};

Extract call ID from URL, start the call, and navigate accordingly.

Recap

  • Android - Intent filters in AndroidManifest, assetlinks.json on domain
  • iOS - RCTLinking in AppDelegate, apple-app-site-association on domain
  • Handling - Use React Native Linking API

Questions or feedback? Reach out to our team.