React Native Deep Linking - Android application opening for all URLs (For configured domain)

1.6k Views Asked by At

We converted our native Android application to React native app and used expo managed workflow for new application. For deeplinking we used linking documentation from expo and everything worked fine. But recently we noticed For some users(Particularly samsung devices), Android App is opening for all URLs (For configured domain).

Intent Filters settings:

{
  "expo": {
    "android": {
      "intentFilters": [
        {
          "action": "VIEW",
          "data": [
            {
              "scheme": "https",
              "host": "*.domain.com",
              "pathPrefix": "/jobs"
            },
            {
              "scheme": "https",
              "host": "*.domain.com",
              "pathPrefix": "/can/recommended-jobs"
            },
            {
              "scheme": "https",
              "host": "*.domain.com",
              "pathPrefix": "/can/cv-views"
            },
            {
              "scheme": "https",
              "host": "*.domain.com",
              "pathPrefix": "/can/conversations"
            },
            {
              "scheme": "https",
              "host": "*.domain.com",
              "pathPrefix": "/can/profile/basic-info"
            },
            {
              "scheme": "https",
              "host": "*.domain.com",
              "pathPattern": "/.*/jobs/.*-.*"
            },
            {
              "scheme": "https",
              "host": "*.domain.com",
              "pathPrefix": "/mobile/can/profile"
            },
            {
              "scheme": "https",
              "host": "*.domain.com",
              "pathPrefix": "/mobile/can/cv-views"
            },
            {
              "scheme": "https",
              "host": "*.domain.com",
              "pathPrefix": "/mobile/"
            },
            {
              "scheme": "https",
              "host": "*.domain.com",
              "pathPrefix": "/mobile/jobs/country"
            },
            {
              "scheme": "https",
              "host": "*.domain.com",
              "pathPattern": "/mobile/jobs-in-.*/.*/.*"
            }
          ],
          "category": ["BROWSABLE", "DEFAULT"]
        }
      ]
    }
  }
}

Even after expo ejection in Expo bare workeflow above issue still exists.

After ejection Android Menifest looks like this.

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.company.android.dev">
  <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:requestLegacyExternalStorage="true">
    <meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="41.0.0"/>
    <activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:screenOrientation="portrait">
      <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
      </intent-filter>
      <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="com.company"/>
        <data android:scheme="com.company.android.dev"/>
      </intent-filter>
      <intent-filter>
        <data android:scheme="https" android:host="*.domain.com" android:pathPrefix="/jobs"/>
        <data android:scheme="https" android:host="*.domain.com" android:pathPrefix="/can/recommended-jobs"/>
        <data android:scheme="https" android:host="*.domain.com" android:pathPrefix="/can/cv-views"/>
        <data android:scheme="https" android:host="*.domain.com" android:pathPrefix="/can/conversations"/>
        <data android:scheme="https" android:host="*.domain.com" android:pathPrefix="/can/profile/basic-info"/>
        <data android:scheme="https" android:host="*.domain.com" android:pathPattern="/.*/jobs/.*-.*"/>
        <data android:scheme="https" android:host="*.domain.com" android:pathPrefix="/mobile/can/profile"/>
        <data android:scheme="https" android:host="*.domain.com" android:pathPrefix="/mobile/can/cv-views"/>
        <data android:scheme="https" android:host="*.domain.com" android:pathPrefix="/mobile/"/>
        <data android:scheme="https" android:host="*.domain.com" android:pathPrefix="/mobile/jobs/country"/>
        <data android:scheme="https" android:host="*.domain.com" android:pathPattern="/mobile/jobs-in-.*/.*/.*"/>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <category android:name="android.intent.category.DEFAULT"/>
      </intent-filter>
    </activity>
      <intent-filter>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
      </intent-filter>
    </activity>
  </application>
</manifest>
0

There are 0 best solutions below