Фильтр намерений для динамических ссылок c не работает должным образом - PullRequest
0 голосов
/ 03 марта 2020

У меня есть следующий фильтр намерений для обнаружения ссылок, которые должны открываться в нашем приложении.

            <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="share.example.tv"
                    android:pathPrefix="/"
                    android:scheme="https" />
                <data
                    android:host="example.tv"
                    android:pathPrefix="/u"
                    android:scheme="https" />
            </intent-filter>

Я хочу, чтобы мое приложение открывалось ниже 2 ссылок

  1. https://share.example.tv/tv34gh
  2. https://example.tv/u/some-user-name

Но мое приложение также отображается для этих ссылок

https://example.tv/anything/literally-anything

1 Ответ

0 голосов
/ 03 марта 2020

Если я разделяю обе ссылки в разных фильтрах намерений для одного и того же действия, как показано ниже

            <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="share.example.tv"
                    android:pathPrefix="/"
                    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="example.tv"
                    android:pathPrefix="/u"
                    android:scheme="https" />
            </intent-filter>

Это работает, но я не знаю почему.

...