Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.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
Java 在添加到android清单进行深度链接时,意图过滤器会导致出现问题_Java_Android_Android Intent_Deep Linking - Fatal编程技术网

Java 在添加到android清单进行深度链接时,意图过滤器会导致出现问题

Java 在添加到android清单进行深度链接时,意图过滤器会导致出现问题,java,android,android-intent,deep-linking,Java,Android,Android Intent,Deep Linking,我正在尝试向我的android应用程序添加深度链接。网站域名是cherishx.com 我想深入链接两条路径,它们都可以打开不同的活动 路径1-cherishx.com/experiences/some-cateogray 路径2-cherishx.com/experience/some-experience 请注意上面的主要区别,路径1有“经验s”,路径2只有“经验”(没有s) 我编写的意向过滤器如下所示: <intent-filter> <act

我正在尝试向我的android应用程序添加深度链接。网站域名是cherishx.com

我想深入链接两条路径,它们都可以打开不同的活动

  • 路径1-cherishx.com/experiences/some-cateogray
  • 路径2-cherishx.com/experience/some-experience
请注意上面的主要区别,路径1有“经验s”,路径2只有“经验”(没有s)

我编写的意向过滤器如下所示:

<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="http" />
            <data android:scheme="https" />
            <data android:host="cherishx.com" />
            <data android:pathPattern="/experiences/.*" />
        </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="http" />
            <data android:scheme="https" />
            <data android:host="cherishx.com" />
            <data android:pathPattern="/experience/.*" />
        </intent-filter>

有趣的是,每次只会触发带有“体验”(包括)的意图过滤器。除非我对意图过滤器进行注释,否则“体验”就可以了

不能让它工作。有什么建议吗?

除了提供
android:scheme
android:scheme以外的
属性“
也必须提供。您*可以*继续使用多个
属性,但如果您使用的不是
android:scheme
,您还应该包括
android:scheme
。例如,您可以这样做:

<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="http"
          android:host="cherishx.com"
          android:pathPattern="/experience/.*" />
        <data android:scheme="https"
          android:host="cherishx.com"
          android:pathPattern="/experiences/.*" />
</intent-filter>

:

说明: 向意向筛选器添加数据规范。该规范可以只是一个数据类型(mimeType属性)、一个URI,或者同时是一个数据类型和一个URI。URI由其每个部分的单独属性指定:
:/:[| |]

指定URL格式的这些属性是可选的,但也相互依赖:

如果未为意图过滤器指定方案,则忽略所有其他URI属性。 如果未为筛选器指定主机,则忽略端口属性和所有路径属性


你能试着去掉1).*2)/.*是的,我试过所有的排列,都没用。
<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="http" />
        <data android:scheme="https" />
</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:host="cherishx.com"
          android:pathPattern="/experience/.*" />
        <data android:host="cherishx.com"
          android:pathPattern="/experiences/.*" />
</intent-filter>