Home > Enterprise >  How can the android app link detect the URL's path?
How can the android app link detect the URL's path?

Time:04-19

Now I am trying to develop the android app links. I have specified the paths so that I can open the app when the URL exactly matches. However, I found that if the host is matched, no matter what the path is, the app will be asked to open. Therefore, I would like to fix it. Thanks very much.

Here is my code:

<intent-filter  android:autoVerify="true">
<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.mydomain.com" android:pathPrefix="[mypath1]" />
<data android:scheme="https" android:host="www.mydomain.com" android:pathPrefix="[mypath]" />
</intent-filter>

CodePudding user response:

Use Path instead of pathPrefix

<intent-filter  android:autoVerify="true">
<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.mydomain.com" android:path ="/" />
<data android:scheme="https" android:host="www.mydomain.com" android:path ="/" />
</intent-filter>
  • Related