Android意图过滤数据路径示例

Cas*_*ash 13 android intentfilter android-intent

我尝试在我的intent过滤器中使用以下数据:

<data android:scheme="http" android:host="an.example.i.p" android:pathPrefix="t" />
Run Code Online (Sandbox Code Playgroud)

为什么以下url不会触发它?

http://an.example.i.p/t/v2.aspx/chase/a.test.auto
Run Code Online (Sandbox Code Playgroud)

Ric*_*ler 36

试试android:pathPrefix="/t".该IntentFilter呼叫Uri#getPath和将得到的字符串传递给PatternMatcherUri#getPath与起点的回报/.

  • 哇.这使得它也可以与`android:path`一起使用,但这不是我阅读[文档]的方式(http://developer.android.com/guide/topics/manifest/data-element.html).他们写`scheme:// host:port/path或pathPrefix或pathPattern`这意味着斜杠不是路径或pathPrefix的一部分.文档中非常烦人的不一致.谢谢你搞清楚. (2认同)