Unable to pass deep links with parameters - Android

1

I am trying to pass parameters to deep links in Android and that is not working.

I have specified a hostName variable in the app/build.gradle file to distinguish between UAT and production URLs. This hostName variable is referenced in AndroidManifest.xml like so:

<activity
            android:name=".ui.MyActivity"
            android:theme="@style/MyTheme"
            android:configChanges="orientation"
            android:windowSoftInputMode="adjustResize">

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <!-- deep links for home page. -->
                <data
                    android:scheme="https"
                    android:host="${hostName}"
                    android:pathPrefix="/login.jsp?signup=true" />
            </intent-filter>
        </activity>

I am trying to use adb to test for deep links like so:
adb.exe shell am start -W -a android.intent.action.VIEW -d "https://www.mywebsite.co.in/login.jsp?signup=true" com.myapp.ui.MyActivity

The error I get is:

Starting: Intent { act=android.intent.action.VIEW dat=https://www.mywebsite.co.in/... pkg=com.myapp.android.alpha }
Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=https://www.mywebsite.co.in/... flg=0x10000000 pkg=com.myapp.android.alpha }  

I have read through a number of similar questions here on SO and all of them suggest escaping the special characters. But that has not worked in this case.

Any insights on resolving this will be most welcome.

android
deep-linking
asked on Stack Overflow Jun 12, 2019 by Sriram

2 Answers

0

The android:pathPrefix is invalid in your AndroidManifest.xml.
It should only contain the path element, not the query:

android:pathPrefix="/login.jsp"
answered on Stack Overflow Jun 12, 2019 by Simon Marquis
0

The query string ?signup=true is not part of the path. You cannot filter on query strings.

answered on Stack Overflow Jun 12, 2019 by Joshua de Guzman

User contributions licensed under CC BY-SA 3.0