android - Android 中 Intent 过滤器响应所有 URL?

标签 android url android-intent intentfilter

我想制作一个涉及响应设备上所有 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.youtube.com" android:scheme="http" />
</intent-filter>

但是如何定义 Intent 过滤器来处理不只属于特定域或主机的任何 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:scheme="http"/>
    <data android:scheme="https"/>
    <data android:scheme="about"/>
    <data android:scheme="javascript"/>
</intent-filter>

关于android - Android 中 Intent 过滤器响应所有 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37543004/

相关文章:

java - 如何为 Android Room 请求创建通用 AsyncTask

java - 启动画面粘在屏幕上 - 主要 Activity 未启动

java - 如何在不同的类布局中显示呈现的对象?

java - URL 中的 & 符号使 XML 格式不正确?

php - 使用php和mysql在url中设置一个变量

javascript - 通过 URL 预填充网页字段

即使操作系统杀死应用程序后,Android Activity 仍保留在堆栈中

Android - 从选项卡内的 Activity 中切换选项卡

java - osmdroid 的自定义缩放按钮

android - Android 中的 Firebase 分页