Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/215.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
Android深度链接忽略了某些url_Android_Android Manifest_Deep Linking - Fatal编程技术网

Android深度链接忽略了某些url

Android深度链接忽略了某些url,android,android-manifest,deep-linking,Android,Android Manifest,Deep Linking,我已经成功实现了与我的应用程序的深度链接,但我遇到了一个问题 <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android

我已经成功实现了与我的应用程序的深度链接,但我遇到了一个问题

<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:host="*.example.com"
       android:scheme="https"/>
</intent-filter>
到目前为止我所尝试的:

我尝试输入所有我想手动捕获的URL

<data
   android:host="*example.com"
   android:scheme="https"
   android:pathPrefix="/m/">
<data
   android:host="*example.com"
   android:scheme="https"
   android:pathPrefix="/c/">
<data
   android:host="*example.com"
   android:scheme="https"
   android:pathPrefix="/p/">
...
然后,这将再次开始捕获所有url,包括我要忽略的url

我还尝试使用了
android:pathPattern
,但它无法理解像这样复杂的正则表达式
^((?!redirect)。*$
,当我在字符串中尝试时,它工作得很好

有人知道我怎么能省略某些URL吗

更新:

根据@PLNech的建议,我使用
android:pathPrefix
添加了需要捕获的所有URL,并使用
android:path:“/”
捕获我主页的URL,即


如果我正确理解您的问题,您希望从特定URL列表中排除特定URL。你所尝试的是一个很好的方法

android:pathPattern
不理解您所说的复杂的正则表达式模式

我认为解决你的问题的唯一方法是改变你想省略的URL。更改主机或该URL的一部分,或将名称
example.com
更改为,例如,
example2.com/hello/redirect/
,不提供显式排除某些URL的方法:您可以使用
android:path
显式包含路径,包括将前缀与
android:pathPrefix
匹配的路径,或将通配符与
android:pathPattern
匹配的路径,您可以在其中使用
*
*

在您的情况下,您必须使用
“/”
,并让指向您的应用程序(包括您的主页)打开的网站的每个链接,或者让每个深度链接共享一个通用前缀


您还可以看看airbnb的图书馆,它似乎是。

我明白您的意思。那是我最后的选择。但在此之前,我只需要知道,有什么解决方案可以解决这个问题。如果我不在末尾加“/”怎么办
<data
   android:host="*example.com"
   android:scheme="https"
   android:pathPrefix="/m/">
<data
   android:host="*example.com"
   android:scheme="https"
   android:pathPrefix="/c/">
<data
   android:host="*example.com"
   android:scheme="https"
   android:pathPrefix="/p/">
...
android:pathPrefix="/"
 <data
   android:host="*.example.com"
   android:scheme="https"
   android:path="/"/>
 <data
  android:host="*example.com"
  android:scheme="https"
  android:pathPrefix="/m/">
 <data
  android:host="*example.com"
  android:scheme="https"
  android:pathPrefix="/c/">
 <data
  android:host="*example.com"
  android:scheme="https"
  android:pathPrefix="/p/">