有关从URL启动Android应用 [英] About starting Android app from an URL
问题描述
第一件事:我知道,这已经被问过很多次......是的,我读过所有的帖子
First thing: I know that this has been asked many times before... Yes I had read all that post
现在的问题是,在没有后有人说我应该怎么写我的网址。 所以我的问题是:我怎么能启动一个应用程序从一个网址,我应该怎么写网址
The problem is that in none post it's been said how should I write my URL. So my question is: How can I start an app from an URL and how should I write that URL.
我得到了以下code在MI AndroidManifest:
I got the following code in mi AndroidManifest:
<activity android:name=".MyActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"></action>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.LAUNCHER"></category>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:host="my.app" android:scheme="http"></data>
</intent-filter>
</activity>
我不得不使用像其在这个帖子<一个被说的网址href="http://stackoverflow.com/questions/2430045/how-to-register-some-url-namespace-myapp-app-start-for-accessing-your-progra/2430468#5651246">How注册某些URL命名空间(的myapp://app.start/)吗?通过调用浏览器在Android操作系统的URL访问你的程序
但没有任何反应。 请让我知道,如果我的意图是写得很好,我应该怎么要我写调用该应用程序的URL。而且请注意,我需要调用我的主的活动。
But nothing happens. Please let me know if my intent is well written and how should I should I write the URL that calls that app. And note that I need to call my "Main" Activity.
谢谢指教!
推荐答案
您需要有两个&LT;意向滤光器&gt;
此元素 &LT;活性GT;
。一会是主
和 LAUNCHER
。另将成为查看
,可浏览
/ 默认
,和你的&lt;数据&GT;
元素:
You need to have two <intent-filter>
elements for this <activity>
. One will be for MAIN
and LAUNCHER
. The other will be for VIEW
, BROWSABLE
/DEFAULT
, and your <data>
element:
<activity android:name=".MyActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"></action>
<category android:name="android.intent.category.LAUNCHER"></category>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:host="my.app" android:scheme="http"></data>
</intent-filter>
</activity>
然后,的http://my.app </ code>应启动你的活动
Then, http://my.app
should launch your activity.
这篇关于有关从URL启动Android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!