Nazerke
Nazerke

Reputation: 2098

"Or" in pathpattern in Intent filter

How can I say the link has to be "https://www.example.org/kk/article/Details" or "https://www.example.org/ru/article/Details" or "https://www.example.org/en/article/Details"

Need to figure out "kk or en or ru" part in the path pattern in the code below

   <intent-filter android:label="login">
    <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"
                        android:host="www.example.org"
                        android:pathpattern="/kk or en or ru/article/Details" />
                </intent-filter>

Upvotes: 0

Views: 2008

Answers (4)

pask23
pask23

Reputation: 734

it's a old question but maybe is useful for new user. There is a solution more simple and is:

<intent-filter android:label="login">
    <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"
          android:host="www.example.org" 
          android:pathpattern="/.*/article/Details" />
</intent-filter>

Upvotes: 0

Almis
Almis

Reputation: 3819

The android:pathpattern doesn't support all those rules that normal regex does. For more information read this. The only way to do that is like this:

<intent-filter android:label="login">
    <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" android:host="www.example.org" android:pathpattern="/kk/article/Details" />
    <data android:scheme="https" android:host="www.example.org" android:pathpattern="/en/article/Details" />
    <data android:scheme="https" android:host="www.example.org" android:pathpattern="/ru/article/Details" />
</intent-filter>

Upvotes: 4

spaceMonkey
spaceMonkey

Reputation: 4615

<intent-filter android:label="login">
    <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" />
android:host="www.example.org" />
android:pathpattern="/kk/article/Details" />
android:pathpattern="/en/article/Details" />
android:pathpattern="/ru/article/Details" />

Upvotes: 1

Thomas R.
Thomas R.

Reputation: 8073

You need to define all types, i.e. you need to specify data tag for each path value.

Upvotes: 1

Related Questions