Reputation: 3603
I am using Android App Links to take users to a specific screen directly in my app. I am following the same approach as Rakuten, meaning the last path segment(LPs) of the URL is a valid domain, which lands users to a specific brand screen on my app.
https://www.rakuten.com/nike.com (lps = nike.com)
https://www.rakuten.com/adidas.com (lps = addidas.com)
https://www.rakuten.com/samsung.com (lps = samsung.com)
Android Manifest Code
<data android:host="www.rakuten.com" android:scheme="https" android:pathPattern=".*..*"/>
The pathPattern = ".*..*"
allows any domain in the URL to open inside my app. All of the below links open Nike brand screen in my app.
https://www.rakuten.com/dir1/nike.com
https://www.rakuten.com/dir1/dir2/nike.com
https://www.rakuten.com/dir1/dir2/dir3/nike.com
https://www.rakuten.com/dir1/dir2/dir3/dir4/nike.com
CASE TO HANDLE:
if any URL contains /browser/
(meaning subdirectory name = browser
), I want to open that URL in the browser and not inside my app.
https://www.rakuten.com/browser/nike.com (should open in browser and not in-app)
Is there any possibility to do that?
Upvotes: 5
Views: 5275
Reputation: 1283
Unfortunately we can't exclude any certain url, since Android doesn't provide that option.
The best practice is to give as precise pathPrefix as possible.
<data android:scheme="https"
android:host="www.rakuten.com"
android:pathPrefix="/dir1/" />
So it will open https://www.rakuten.com/dir1/* links
Upvotes: 2
Reputation: 29
try using:
<data android:host="www.rakuten.com/app" android:scheme="https" android:pathPattern=".*..*"/>
All routes that you want to open in app should live under www.rakuten.com/app
All routes that you want to open in browser should live under www.rakuten.com/
Upvotes: 0