Deliplink intent filter for a specific path Prefix?

I have included a deep link to my Android app and it works great.

However, I want the intent filter to listen on a particular pathPrefix only ie http(s)://(www.)mydomain.com/e , and not any other pathPrefix .

Is it possible? I am attaching my intent filter code in AndroidManifest.xml

 <intent-filter android:label="My App Name"> <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="www.domain.com" android:pathPrefix="/e" /> <data android:scheme="http" android:host="mydomain.com" android:pathPrefix="/e" /> <data android:scheme="https" android:host="www.mydomain.com" android:pathPrefix="/e" /> <data android:scheme="https" android:host="mydomain.com" android:pathPrefix="/e" /> </intent-filter> 
+5
source share
2 answers

With this part of the manifest, you are telling your device to start an Activity that contains this intent filter with all the URL that has

  • http or https as a protocol
  • www.mydomain.com or mydomain.com as host
  • / e as a path prefix

Since the question is related to pathPrefix, your activity will handle all URLs whose path has / e at the beginning. For instance:

  • http (s): // (www.) mydomain.com/e - MATCH
  • http (s): // (www.) mydomain.com/eXXX - MATCH
  • http (s): // (www.) mydomain.com/e/a - MATCH
  • http (s): // (www.) mydomain.com/eXXX/a - MATCH
  • http (s): // (www.) mydomain.com/e?a=b - MATCH
  • http (s): // (www.) mydomain.com/Xe - NOT MATCH
  • http (s): // (www.) mydomain.com/X/e?a=b - NOT MATCH
+2
source

Since the code you inserted is good for this pathPrefix , I assume you only want to catch http(s)://(www.)mydomain.com/e and nothing else?
If so, use path instead of pathPrefix like this.

 <intent-filter android:label="My App Name"> <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="www.domain.com" android:path="/e" /> <data android:scheme="http" android:host="mydomain.com" android:path="/e" /> <data android:scheme="https" android:host="www.mydomain.com" android:path="/e" /> <data android:scheme="https" android:host="mydomain.com" android:path="/e" /> </intent-filter> 
0
source

All Articles