Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/195.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在Android上使用带有路径参数的React导航通用链接?_Javascript_Android_React Native_React Navigation_Deep Linking - Fatal编程技术网

Javascript 如何在Android上使用带有路径参数的React导航通用链接?

Javascript 如何在Android上使用带有路径参数的React导航通用链接?,javascript,android,react-native,react-navigation,deep-linking,Javascript,Android,React Native,React Navigation,Deep Linking,我有以下域:https://demoproject.com 我想将所有带有/demo路径参数的URL-s链接到Android上的React本机应用程序,例如URLhttps://demoproject.com/demo?a=1&b=2将被链接,但将排除具有相同域但不同路径参数的任何其他URL 现在我使用的是React Navigation 5,如下所示: const linking = { prefixes: ['https://demoproject.com'], config

我有以下域:
https://demoproject.com

我想将所有带有
/demo
路径参数的URL-s链接到Android上的React本机应用程序,例如URL
https://demoproject.com/demo?a=1&b=2
将被链接,但将排除具有相同域但不同路径参数的任何其他URL

现在我使用的是React Navigation 5,如下所示:

const linking = {
    prefixes: ['https://demoproject.com'],
    config: {
      DemoScreen: {
          path: '/demo/*'
      }
    }
};
<NavigationContainer linking={linking}>
const链接={
前缀:['https://demoproject.com'],
配置:{
演示屏幕:{
路径:'/demo/*'
}
}
};
AndroidManifest.xml


链接本身工作正常,但问题是所有带有前缀
https://demoproject.com
正在链接,而我只希望链接带有
/demo
路径参数的URL-s

我试过:

  • -没有链接任何URL-s
  • 前缀:['https://demoproject.com/demo']
    -所有带有
    https://demoproject.com
    域已链接

有没有办法解决这个问题或者我做错了什么?

必须在IntentFilter中用
路径前缀
路径模式
定义它:

<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="https" />
      <data android:host="demoproject.com" android:pathPrefix="/demo/" />
</intent-filter>


android:pathPrefix锁定了它
<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="https" />
      <data android:host="demoproject.com" android:pathPrefix="/demo/" />
</intent-filter>