Android 在 Intent 中响应 URL [英] Android Respond To URL in Intent

查看:32
本文介绍了Android 在 Intent 中响应 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在用户访问某个 url 时启动我的意图:例如,android 市场使用 执行此操作http://market.android.com/ 网址.优酷也是.我也希望我的也这样做.

I want my intent to be launched when the user goes to a certain url: for example, the android market does this with http://market.android.com/ urls. so does youtube. I want mine to do that too.

推荐答案

我做到了!使用 .将以下内容放入您的清单文件:

I did it! Using <intent-filter>. Put the following into your manifest file:

<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>

这很好用!

这篇关于Android 在 Intent 中响应 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆