我们将原生 Android 应用程序转换为 React 原生应用程序,并为新应用程序使用 expo 托管工作流。对于深度链接,我们使用了来自 expo 的链接文档,一切正常。但最近我们注意到对于某些用户(特别是三星设备),Android 应用程序正在为所有 URL 开放(对于配置的域)。
意图过滤器设置:
{
"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"]
}
]
}
}
}
即使在世博会裸工作流中的世博会弹出后,上述问题仍然存在。
弹出后 Android Menifest 看起来像这样。
<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>