cocoahero
cocoahero

Reputation: 1302

Android Navigation Deep Link - Ignore Query

I'm attempting to add a deep-link for a URL that has the following format:

<deepLink
        android:id="@+id/deep_link"
        android:autoVerify="true"
        app:uri="my.example.com/articles/{slug}" />

This causes the slug argument passed to my destination to also include the query if it exists. For example, the URL my.example.com/articles/recent-article?utm=1 results in the slug argument being recent-article?utm=1.

I've tried using the following pattern format in an attempt to ignore the query, but URLs no longer match correctly.

<deepLink
    android:id="@+id/deep_link"
    android:autoVerify="true"
    app:uri="my.example.com/articles/{slug}?*.*" />

Is there a way to effectively ignore the query?

Upvotes: 0

Views: 1112

Answers (1)

ianhanniballake
ianhanniballake

Reputation: 200080

Assuming you're using the latest Navigation 2.2.0-rc04 (or one of the other Navigation 2.2 releases that adds support for query parameters), it sounds like you're hitting this issue where deeplinks without query parameters don't ignore query parameters.

The workaround mentioned in the bug is to include a dummy parameter:

<deepLink
    android:id="@+id/deep_link"
    android:autoVerify="true"
    app:uri="my.example.com/articles/{slug}?dummy={dummy} />

Upvotes: 1

Related Questions