从浏览器Android的推出意图 [英] Android Intent launch from browser
问题描述
这个话题之前已经覆盖,但我找不到具体要问什么,我的答案。
This topic has been covered before, but I can't find an answer specific to what I'm asking.
我在哪里:我跟着hackmod第一块在这里建议:<一href=\"http://stackoverflow.com/questions/3469908/make-a-link-in-the-android-browser-start-up-my-app/3472228#3472228\">Make在Android浏览器链接启动我的应用程序?并得到这个在网页的链接工作。
Where I am: I followed hackmod's first piece of advice here: Make a link in the Android browser start up my app? and got this to work with a link in the webpage.
不过,我无法理解的第二个选项(意向的URI)。这里是我得到了什么:
However, I'm having trouble understanding the second option (intent uri's). here's what I've got:
<activity android:name="com.myapps.tests.Layout2"
android:label="Auth Complete"
>
<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" android:host="mydomain.com"
android:path="/launch" />
</intent-filter>
</activity>
现在,与我可以去mydomain.com/launch,并启动我的活动。这一切运作良好,但我得到的选择器。我要的是它只是启动我的活动没有给予选项。
Now, with that I can go to "mydomain.com/launch" and it launches my activity. this all works well, except that I get the chooser. what I want is for it to just launch my activity without giving options.
从在岗的解释,我引用它看起来像多数民众赞成意图的URI是的,但我无法找到一个简单的例子。我应该在我的我的网页链接看起来像以没有选择器推出呢?
From the explanation in the post I referenced it looks like thats what intent uris are for,but I can't find a straightforward example. what should my link in my webpage look like in order to launch this with no chooser?
我见过几个例子,看起来是这样的:
I've seen a couple of examples that look something like this:
<a href="intent:#Intent;action=com.myapp.android.MY_ACTION;end">
不过,这似乎并不当我尝试它的工作。
However, that doesn't seem to work when I try it.
我的测试设备是Galaxy Tab的2
My test device is a Galaxy Tab 2.
任何帮助将是AP preciated。
any help would be appreciated.
推荐答案
根据您的意图过滤此链接应该工作:
Depending on your intent filter this link should work:
<a href="http://mydomain.com/launch">start my app</a>
但是你要注意的是,Android系统将询问用户是否您的应用程序或其他任何浏览器应启动。
But you should note that the android system will ask the user if your app or any other browser should be started.
如果你想避免这种实现自定义协议型处理器。所以只要你的应用程序将侦听,用户将无法获得意图选择器。
If you want to avoid this implement a custom protcol handler. So just your app will listen for that and the user won't get the intent chooser.
尝试添加该数据的意图:
Try to add this data intent:
<data android:scheme="mycoolapp" android:host="launch" />
随着code本以上链接应该工作:
With the code above this link should work:
<a href="mycoolapp://launch">start my app</a>
这篇关于从浏览器Android的推出意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!