应用程序未拦截的URL [英] application is not intercepting url

查看:139
本文介绍了应用程序未拦截的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图拦截在Android上我自己的应用程序的网址,使用户可以在应用程序而不是在浏览器中打开URL。 (我没有浏览器的支持还)。

I am trying to intercept my own app's URL on android so that the user can open the URL in the app rather than on the browser. (I don't have browser support yet).

这是我在做什么。

<activity android:name=".ui.activity.MainActivity" android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.PICK_ACTIVITY" />
        <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:host="myapp.com" />
        <data android:pathPattern=".*"/>
    </intent-filter>
</activity>

出于某种原因,我随时打开 myapp.com 它仍保持打开浏览器,不给我我的应用程序打开URL的选项。我与16 API上运行我的模拟器尝试此。我已经关闭了仿真几次,但再次启动仍是其相同的行为。

For some reason anytime I open myapp.com it still keeps opening in the browser, without giving me the option to open the URL in my app. I am trying this on my emulator with API 16 running on it. I've closed the emulator several times and started it again but still its the same behavior.

要避免在我个人的应用程序的URL的任何错误。我甚至尝试用:

To avoid any errors in the URL of my personal app. I even experimented with:

         <data android:host="goo.gl" android:scheme="http" />
         <data android:host="goo.gl" android:scheme="https" />

该应用目前截取上述网址,但只有第一次。如果我在选项presented点击只来过一次',我不要再不断,直到我重新启动仿真得到的选项。

The app DOES intercept the above url but ONLY the first time. If I click 'JUST ONCE' in the options presented, I don't get the option ever again until I restart the emulator.

有没有人通过这个去了?什么可能我是做错了?

Has anyone gone through this? What might I be doing wrong?

推荐答案

这个回答让我:的链接质疑

如果您添加软件包名字的意图,它会默认打开应用

if you add the package name to the intent, it will open your app by default

这篇关于应用程序未拦截的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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