为什么Android无法处理路径中包含#的Deeplink网址 [英] Why android does not handle a deeplink url which has # in the path

查看:199
本文介绍了为什么Android无法处理路径中包含#的Deeplink网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

URL http://javaexample.com/#/topics 是有效的URL吗?

The url http://javaexample.com/#/topics is a valid url?

我尝试使用以下方法在应用程序中深度链接上述网址:

I am try to deeplink the above url in the app using:

  <intent-filter android:label="@string/app_name">
            <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="javaexample.com"
                android:pathPrefix="/#/topics" />
        </intent-filter> 

但终端抛出消息-

活动尚未开始,无法解决Intent {act = android.intent.action.VIEW dat = http://javaexample.com/ ...

Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=http://javaexample.com/...

是网址 http:/ /javaexample.com/#/topics 如果路径中包含#,则不是有效的网址?

is url http://javaexample.com/#/topics is not a valid url if it has # in the path?

推荐答案

URL中的表示片段组件,不能用于深度链接标准。即使您将片段的结构构造为外观就像人眼的正常URL路径,计算机也不会以这种方式读取它。

The # in a URL indicates the beginning of the fragment component, which cannot be used for deep link criteria. Even though you've structured the fragment to look like a normal URL path to human eyes, the computer does not read it this way.

您需要重新格式化URL,在路径之前不要包含任何字符。

You'll need to reformat your URLs not to include any # character before the path.

这篇关于为什么Android无法处理路径中包含#的Deeplink网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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