Search code examples
javaandroiddeep-linking

Null query parameter from deeplink


I have implemented deep linking into my android application, Everything is working fine except for getting query parameters from the URL.

I am following the instructions at this link to get parameters.

The URL looks like this:

myapp://path/want?a=123&b=345

I am doing something like this:

deeplink :- myapp://path/want?a=first&b=second

Uri uri = getIntent().getData();
String valueOne = uri.getQueryParameter("a");
String valueTwo = uri.getQueryParameter("b");

I am getting the correct value of "valueOne" but getting null for "valueTwo", and I can't figure out why.


Solution

  • It's been awhile.. hope this can help somebody:

    I hit the same issue recently.

    • If testing a deep link in command line adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "http://test.com/service1?param1=value1&param2=value2" only first query parameter is kept. (&param2=value2 is dropped) Looks like a bug.
    • If testing a deep link by clicking the highlighted link in gmail (in my case I use google keep note) all parameters are being passed as expected