Search code examples
androidandroid-manifestdeep-linkingintentfilterapplinks

Intent filter: Handel hashtag sign on pathPattern and pathPrefix


I need your help to fix a problem with an intent filter that launches the activity after clicking a URI that looks like this https://myapp.com/#/path1/path2. Is there a way to escape hashtag signs when creating a path pattern? I’ve tried /\\#/ , /%23/ and /.*/ without success. Is there a way to override the default UriMatcher?


Solution

  • I need your help to fix a problem with an intent filter that launches the activity after clicking a URI that looks like this https://myapp.com/#/path1/pathe2.

    My guess is that you would need to create an <intent-filter> just with the scheme and host, accepting all paths. You might be able to limit it to just a path of / — I have not tried matching only the / path of a domain.

    Is there a way to escape hashtag signs when creating a path pattern?

    In your example, your path is /. # is not part of the path. In URL syntax, # represents the separator that precedes the fragment portion of the URL. Your fragment is /path1/pathe2. You cannot match on a fragment (or query parameters) in an <intent-filter>.

    Is there a way to override the default UriMatcher?

    In custom firmware? Yes. In an app? No, because it is not part of your app.