Skip to content

Latest commit

 

History

History
72 lines (60 loc) · 3.06 KB

File metadata and controls

72 lines (60 loc) · 3.06 KB
title Expo Deep linking integration
category 5f9705393c689a065c409b23
parentDoc 645213236f53a00d4daa9230
order 8
hidden false

Getting started

Prerequisite: see Expo Installation for the React Native / Expo SDK version requirements.

See Deep Linking Integration for concepts — this doc covers Expo-specific wiring only.

Implementation for Expo

  1. App.json configuration: Configure intent filters, URI scheme, and associated domains as described in Expo's guide. See the Full app.json example below.

  2. iOS AppDelegate wiring: The Expo config plugin automatically injects the required AppsFlyer deep-link handlers into your app's AppDelegate at expo prebuild time. For both ObjC and Swift templates, it adds:

    • AppsFlyerAttribution.shared.handleOpen(url:options:) into openURL
    • AppsFlyerAttribution.shared.continueUserActivity(userActivity:restorationHandler:) into continueUserActivity (forwarding the real restorationHandler)
    • AppsFlyerAttribution.shared.handleLaunchOptions(launchOptions) into didFinishLaunchingWithOptions

    All three route through AppsFlyerAttribution.shared, not AppsFlyerLib.shared() directly — one import (react_native_appsflyer) covers the whole AppDelegate. See Deep Linking Integration for why openURL/continueUserActivity buffer (calls that arrive before start() has succeeded natively); handleLaunchOptions has no such hazard and forwards immediately.

    See Expo Installation for full details.

  3. Android deep-link handling: You must add setIntent() inside the onNewIntent method as described here. This plugin does not add this code automatically, so implement it manually or with a custom config plugin.

Deep linking configuration

The following app.json snippet shows the deep-linking-specific configuration. For the full list of plugin configuration options, see Expo Installation.

{
  "expo": {
    "plugins": [
      "react-native-appsflyer"
    ],
    "scheme": "my-own-scheme",
    "ios": {
      "bundleIdentifier": "com.appsflyer.expoaftest",
      "associatedDomains": ["applinks:expotest.onelink.me"]
    },
    "android": {
      "package": "com.af.expotest",
      "intentFilters": [
        {
          "action": "VIEW",
          "data": [
            {
              "scheme": "https",
              "host": "expotest.onelink.me",
              "pathPrefix": "/DvWi"
            }
          ],
          "category": ["BROWSABLE", "DEFAULT"]
        },
        {
          "action": "VIEW",
          "data": [
            {
              "scheme": "my-own-scheme"
            }
          ],
          "category": ["BROWSABLE", "DEFAULT"]
        }
      ]
    }
  }
}