2015-07-31 5 views
5

Ich habe tiefe Verknüpfung auf meiner Android-App aktiviert und es funktioniert gut.Deeplink Intent-Filter auf einen bestimmten pathPrefix?

Ich möchte jedoch, dass der Intent-Filter nur auf einen bestimmten pathPrefix hört, d. H. und nicht auf einen anderen pathPrefix.

Ist das möglich? Ich meine Absicht-Filtercode 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> 

Antwort

2

Mit diesem Stück manifest Anbringen doch sagen, Sie auf Ihrem Gerät die Aktivität zu starten, die mit allen url dass Intent-Filter enthält, die

    haben
  1. HTTP- oder HTTPS-Protokoll als
  2. www.mydomain.com oder mydomain.com als Wirt
  3. /e als Präfix des Pfades

Da sich die Frage auf pathPrefix bezieht, behandelt Ihre Aktivität alle URLs, deren Pfad am Anfang a/e hat. Zum Beispiel:

  • 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 - NICHT ABGLEICHEN
  • http (s) : // (www.) mydomain.com/X/e?a=b - DO NICHT
+0

Ich würde diese Lösung auch vorschlagen, das war meine erste Absicht. –

0

MATCH Da der Code von Ihnen eingefügt für die pathPrefix gut, ich bin zu raten Sie nur http(s)://(www.)mydomain.com/e und nichts anderes fangen wollen?
Wenn dies der Fall ist, verwenden Sie path anstelle von pathPrefix wie so.

<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> 
Verwandte Themen