【问题标题】:Path pattern for intent-filter意图过滤器的路径模式
【发布时间】:2013-03-06 10:39:41
【问题描述】:

我想在点击 URL 时启动 Android 应用程序(可能是电子邮件或短信)。

如何为这两个 URL 编写不同的路径模式?

  • http://www.hostname.com/folder1/file.ext
  • http://www.hostname.com/folder1/folder2/file.ext

我只想从第一个 URL 而不是第二个 URL 启动我的活动。目前我正在使用这个intent-filter,但它正在使用两个 URL 启动我的应用程序。

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />

    <data
        android:host="www.hostname.com"
        android:pathPattern=".*\\/folder1/*"
        android:scheme="http" />
</intent-filter>

【问题讨论】:

    标签: android path intentfilter


    【解决方案1】:

    试试下面的代码

    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
    
        <data
            android:host="www.hostname.com"
            android:pathPrefix="/folder1"
            android:scheme="http" />
    </intent-filter>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-24
      • 1970-01-01
      • 2016-01-21
      • 1970-01-01
      • 2011-04-02
      • 1970-01-01
      • 2016-10-17
      • 2019-12-12
      相关资源
      最近更新 更多