kira_codes
kira_codes

Reputation: 1616

Android intent filter drops query string

I have defined a data tag in my intent-filter node of AndroidManifest.xml like so:

<data
    android:scheme="http"
    android:host="example.com"
    android:pathPrefix="/path/pageEnum" />

the path I am trying to capture is http://example.com/path/pageEnum?one=1&two=2&three=3

I am launching the intent from adb like so:

adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "http://example.com/path/pageEnum?one=1&two=2&three=3"

The target activity is launched successfully, but when I call getIntent().getDataString() in onCreate() the string value is http://example.com/path/pageEnum?one=1

All of the query parameters except for the first are dropped.

Is there any workaround to make sure that I get all of the query parameters?

There is nothing in google's documentation about this behavior.

Upvotes: 3

Views: 1476

Answers (1)

Simon Marquis
Simon Marquis

Reputation: 7526

You should wrap your adb shell command with single quotes:

adb shell 'am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "http://example.com/path/pageEnum?one=1&two=2&three=3"'

Upvotes: 8

Related Questions