weei.zh
weei.zh

Reputation: 281

Android handle deep link with a slash in the end of the URL

I want to handle some deep links with a slash in the end of the URL in Android, such as:

https://www.xxx.xxx/mobile/

https://www.xxx.xxx/mobile

The one has a slash in the end of the URL and the other one doesn't have.

I want to use

<data
 android:host="www.xxx.xxx"
 android:pathPattern="/mobile/?"
 android:scheme="https" />

to handle it, but it doesn't work. Does anyone have any idea?

Upvotes: 0

Views: 1902

Answers (2)

Artur  Dumchev
Artur Dumchev

Reputation: 1330

Instead of

android:pathPattern="/mobile/?"

use

android:pathPattern="/mobile.?"

Upvotes: 1

Simon Marquis
Simon Marquis

Reputation: 7526

Use multiple pathPattern:

<data android:host="www.xxx.xxx" android:pathPattern="/mobile" android:scheme="https" />
<data android:host="www.xxx.xxx" android:pathPattern="/mobile/" android:scheme="https" />

Upvotes: 1

Related Questions