[英]Android Deep Linking without android:scheme
I have a activity that apply intent filter to open deeplink, this is my intent filter : 我有一个活动应用意图过滤器打开深层链接,这是我的意图过滤器:
<intent-filter android:autoVerify="true">
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.example.com"
android:pathPattern="/..*"
android:scheme="https" />
</intent-filter>
my problem is, when user open a link ie "www.example.com/somepage" from messaging apps eg Hangout,Whatsapp, Android app chooser doesn't display may apps in its list, it just show all browser app in the options. 我的问题是,当用户打开一个链接,即来自消息应用程序的“www.example.com/somepage”,例如Hangout,Whatsapp,Android应用程序选择器不显示其列表中的应用程序,它只显示选项中的所有浏览器应用程序。 But when user put " https://www.example.com/somepage " in a message then it works, Android show my app in its App chooser to open the link.
但是当用户在消息中添加“ https://www.example.com/somepage ”然后它可以工作时,Android会在其应用选择器中显示我的应用以打开链接。 It also doesn't work When I try to remove
android:scheme="https"
from my intent filter. 当我尝试从我的意图过滤器中删除
android:scheme="https"
,它也不起作用。
is there anyone has same problem and have a solution? 有人有同样的问题并有解决方案吗?
Any help really appreciated. 任何帮助真的很感激。
This is expected behavior. 这是预期的行为。
What the following snippet does is register your app as a handler for the URL scheme https://
以下代码段的作用是将您的应用注册为URL方案的处理程序
https://
<data
android:host="www.example.com"
android:pathPattern="/..*"
android:scheme="https" />
This means your app will be offered as an option for any link beginning with https://
and containing www.example.com
. 这意味着您的应用将作为以
https://
开头且包含www.example.com
任何链接提供。 The string www.example.com/somepage
doesn't qualify, as it is missing the https://
part. 字符串
www.example.com/somepage
不符合条件,因为它缺少https://
部分。
You could try adding a second filter for http://
links. 您可以尝试为
http://
链接添加第二个过滤器。 I'm not sure if Android automatically infers that as the scheme for web links without a scheme specified, so it's possible this could resolve the issue. 我不确定Android是否会自动推断出没有指定方案的Web链接方案,因此可以解决问题。
<intent-filter android:autoVerify="true">
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.example.com"
android:pathPattern="/..*"
android:scheme="https" />
<data
android:host="www.example.com"
android:pathPattern="/..*"
android:scheme="http" />
</intent-filter>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.