Android的:如何启动我的活动,而不是浏览器 [英] Android : How to Launch My activity instead of Browser

查看:127
本文介绍了Android的:如何启动我的活动,而不是浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新到Android,我设计中,我想用广播接收器的应用程序。通过使用此我想启动我的应用程序,当有人点击浏览器(Android默认浏览器)。如果有人已经做到了这一点,请帮助我。

I am new to android, I am designing an application in which i want to use broadcast receivers. By using this i want to launch my application when somebody clicks on browser (Default android browser). If anybody had done this, please help me.

在此先感谢。

推荐答案

您无法截取主浏览器的推出,但是,你可以让你的应用程序句柄意图用于查看的URL。要做到这一点增加一些像这样的Andr​​oidManifest.xml在活动的部分:

You can't intercept launches of the main browser, however, you can make your application handle intents for viewing URLs. To do this add something like this to AndroidManifest.xml in the section of your activity:

<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" />
</intent-filter>

这篇关于Android的:如何启动我的活动,而不是浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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