3

Reading the docs on the <data> element of android manifest, three different path specification rules are shown:

  • android:path - corresponding to PATTERN_LITERAL of the PatternMatcher class
  • android:pathPrefix - corresponding to PATTERN_PREFIX of the PatternMatcher class
  • android:pathPattern - corresponding to PATTERN_SIMPLE_GLOB of the PatternMatcher class

But on the docs of the PatternMatcher class there is also a PATTERN_ADVANCED_GLOB, yet the manifest documentation does not seem to mention it anywhere. Is it possible to use PATTERN_ADVANCED_GLOB in the manifest file? What is the syntax?

Pedro A
  • 3,989
  • 3
  • 32
  • 56

2 Answers2

4

No.

Reminder, PATTERN_ADVANCED_GLOB was only introduced in API 26 for the PatternMatcher class.

Intent filters in the manifest have limited matching capability, and any change would have to maintain backward compatibility.

See: How to use PathPattern in order to create DeepLink Apps Android?

Morrison Chang
  • 11,691
  • 3
  • 41
  • 77
  • Thanks. Do you know if there is a work in progress to create a new syntax for this "fourth option"? – Pedro A Feb 03 '19 at 03:25
  • Google doesn't pre-announce changes/features. Given that [this bug on PatternMatcher](https://issuetracker.google.com/issues/36994559) is still outstanding for almost 5 years, I am not hopeful. This type of change is at the framework level, so realize that Google/Android team would need to make sure the pattern match "fix/feature add" wouldn't break existing apps, or they would have to build everything for forcing developers to support v1 (old style) and v2 (new style) pattern match in the manifest. – Morrison Chang Feb 03 '19 at 04:34
  • I see - but well they could create a `android:pathPatternAdvanced` and leave the rest untouched, surely that wouldn't break anything. But this is getting off-topic. Thank you! – Pedro A Feb 03 '19 at 11:58
1

Seems that android:pathAdvancedPattern was introduced in API26 but only documented in late 2022 (between September and December)

Note: R.attr.pathAdvancedPattern documentation was added early 2021 with the the API 31 (Android S) documentation drop.

H/T https://proandroiddev.com/how-to-handle-deep-link-with-complex-path-like-this-811216a0c802

The pathAdvancedPattern is claimed to work with API 26, but experiments on the Pixel emulator have shown that prior to API 31, the attribute is ignored and intent-filter accepts any path. Perhaps the behaviour will be different when testing on real devices and devices with shells from other vendors. I’ve also tested pathAdvancedPattern on my Samsung, One UI 4.1, Android 12.0 and the behaviour was not different.

Mark
  • 7,446
  • 5
  • 55
  • 75