2016-02-26 6 views
21

Ich versuche, meine App tief zu verknüpfen und habe in meiner AndroidManifest.xml Folgendes implementiert, um die richtige Aktivität zu öffnen.Android Deep Linking mit mehreren Abfrageparametern

<activity 
    android:name=".ui.activities.MyActivity" 
    android:label="@string/title_activity" 
    android:screenOrientation="portrait"> 
    <!-- ATTENTION: This intent was auto-generated. Follow instructions at 
    https://g.co/AppIndexing/AndroidStudio to publish your Android app deep links. --> 
    <intent-filter> 
     <action android:name="android.intent.action.VIEW" /> 

     <category android:name="android.intent.category.DEFAULT" /> 
     <category android:name="android.intent.category.BROWSABLE" /> 
     <!-- ATTENTION: This data URL was auto-generated. We recommend that you use the HTTP scheme. 
     TODO: Change the host or pathPrefix as necessary. --> 
     <data 
      android:host="myHost" 
      android:scheme="myCustomScheme" /> 
    </intent-filter> 
</activity> 

Und ich Testen der Aktivität von adb

adb shell am start -W -a android.intent.action.VIEW -d "myCustomScheme://myHost?key=category_parent_id&value=92&title=test" com.myApp.android 

Die Aktivität unter Verwendung öffnet aber die URI, die auf die Aktivität in der Absicht geleitet wird, ist nur

myCustomScheme://myHost?key=category_parent_id 

Seine Überspringe alles nach '&'

Ich sah hier auf SO aber nicht finde alles mit mehreren Abfrageparametern.

Jede Hilfe wäre willkommen. :)

Antwort

48

fügen Sie bitte \ vor & Zeichen, wenn mit adb Prüfung

Kopie dieses

adb shell am start -W -a android.intent.action.VIEW -d "myCustomScheme://myHost?key=category_parent_id\&value=92\&title=test" com.myApp.android

+0

Dank nicht vergessen! das hat wie Charme funktioniert! –

+0

Mein Vergnügen !!!! –

+0

Arbeitete für mich. Weiß jemand, warum musst du das tun? –

5

Sie den Shell-Befehl mit einfachen Anführungszeichen wickeln kann (Modifizieren der uri Inhalt zu vermeiden):

adb shell 'am start -d "myCustomScheme://myHost?key=category_parent_id&value=92&title=test"' 
-1

Codieren Sie einfach Ihre URL-Parameter und es wird funktionieren. Es könnte Googles Parsing Bug sein.

Vorher:

adb shell am start -W -a android.intent.action.VIEW -d "myCustomScheme://myHost?key=category_parent_id&value=92&title=test" com.myApp.android 

Nach:

adb shell am start -W -a android.intent.action.VIEW -d "myCustomScheme://myHost?key%3Dcategory_parent_id%26value%3D92%26title%3Dtest" com.myApp.android 
1

Für osx/Mac-Nutzer mit Android-Studio

Last adb

export PATH="/Users/your_user/Library/Android/sdk/platform-tools":$PATH 

Überprüfen Sie, ob die App erkannt

adb shell am start -n com.package/.activities_package_name.MainActivity 

Test-Deeplink

adb shell 'am start -W -a android.intent.action.VIEW -d "myCustomScheme://myHost?key=category_parent_id\&value=92\&title=test" com.myApp.android' 

Sie den ''