expo: EAS Build: Android applinks (intent filters or deeplink config) do not work with autoFilter:true in EAS build

Summary

Hi I have been using EAS build to distribute and run on production.

I use android intentfilters to directly open the app (when the auto verify is true).

Config in reproducible demo

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

Android

SDK Version (managed workflow only)

42.0

Environment

Expo CLI 4.13.0 environment info: System: OS: macOS 11.6 Shell: 3.2.57 - /bin/bash Binaries: Node: 16.1.0 - /usr/local/bin/node Yarn: 1.22.11 - /usr/local/bin/yarn npm: 7.17.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4 IDEs: Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild npmPackages: expo: ^42.0.0 => 42.0.5 react: 16.13.1 => 16.13.1 react-dom: 16.13.1 => 16.13.1 react-native: ~0.63.4 => 0.63.4 react-native-web: ~0.13.12 => 0.13.18 npmGlobalPackages: expo-cli: 4.13.0 Expo Workflow: managed

Reproducible demo

"intentFilters": [
        {
          "autoVerify": true,
          "action": "VIEW",
          "data":
          {
              "scheme": "https",
              "host": "mydomain.com",
              "pathPrefix": "/applogin"
            },
          "category": [
            "BROWSABLE",
            "DEFAULT"
          ]
        }
      ]

This config works on expo build and applinks are auto verified, so the link directly opens the app. But on EAS build the app is not directly opened and it asks for how to open the app. Am I missing something when it comes to applinks (deeplinks) in android

In androidManifest.xml, it takes this form:

  <intent-filter android:autoVerify="true">
        <data android:scheme="https" android:host="mydomain.com" android:pathPrefix="/applogin"/>
        <data android:scheme="exp+appname"/>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <category android:name="android.intent.category.DEFAULT"/>
      </intent-filter>

Still does not work as intended. I have also hosted the file on /.well-known/assetlinks.json and it works with the expo build workflow. Not the app link workflow.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

I have had the same issue in a managed project + dev client. Looks like, when adding intentFilters to the app.config.js file, expo updates the AndroidManifest.xml file and includes something similar to:

<intent-filter android:autoVerify="true" data-generated="true">
        <action android:name="android.intent.action.VIEW"/>
        <data android:scheme="https" android:host="yourhost" android:pathPrefix="your-path-prefix"/>
        <data android:scheme="exp+<your app name>"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <category android:name="android.intent.category.DEFAULT"/>
      </intent-filter>

This bit <data android:scheme="exp+<your app name>"/> seems to be the problem, causing auto verify not to work properly. I have confirmed it by only removing that line, building the app via expo run:android, and testing app links, which are working fine. By now, I intend to create an expo config plugin to add the intent-filter directly without having to do it via app.config.js

Hey @ajimenezdev I ended up relying on this implementation https://github.com/expo/expo/issues/19745 Looks like someone at the Expo team also experienced this and provided a plugin in that ticket. You can find it under the section withAndroidVerifiedLinksWorkaround.js. Hope it helps!

Hey Brent, Thanks for all the prompt responses, especially the ones over the weekend. I will check out the config plugin.

If you guys need any help, I can share the exact code if needed including the applink files.