从URL启动应用程序 [英] Launching an App from a URL
问题描述
当尝试从注册电子邮件中单击特定URL时,我试图启动Android应用程序选择器.我已经看过下面的问题和其他几个问题,但是我仍然没有运气.
I am attempting to get the Android application chooser to launch when a specific URL is clicked from within a registration e-mail. I have already looked at the below question and several others but I am still having no luck with this.
我已经在AndroidManifest.xml文件中创建了我的意图,如下所示(我将我的网站地址放置在您看到".website.org"的位置):
I have created my intent in the AndroidManifest.xml file as below (I've placed my website address where you see ".website.org"):
<activity android:name=".MainActivity" android:configChanges="orientation|screenSize">
<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.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
android:host="*.website.org"
android:path="/" />
</intent-filter>
</activity>
有人能协助我解决我可能缺少的其他东西吗,因为它当前没有启动任何功能,而只是将链接直接加载到默认的网络浏览器中?
Is anyone able to assist me with what else I may be missing, as this is currently not launching anything and it's just loading the link directly in the default web browser?
推荐答案
感谢您的答复.最后,我不得不将意图更改为以下内容,并且达到了预期的效果.当我单击意图中指定的URL时,将弹出应用程序选择器,允许我将链接加载到我的应用程序中.
Thanks for your replies. In the end I had to change my intent to the below and it had the desired result. When I click the URL specified in my intent the application chooser pops up allowing me to load the link in my app.
就像为任何挣扎于我的人提供的信息一样,您无需从传入的意图中读取数据即可启动应用选择器,您所需要的只是AndroidManifest文件中的以下内容.
Just as info for anyone struggling as I did, you do not need to read data from incoming intents for the application chooser to launch, all you need is the below in your AndroidManifest file.
<intent-filter android:autoVerify="true">
<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" />
<data android:host=".website.com" />
</intent-filter>
谢谢.
这篇关于从URL启动应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!