Why android does not handle a deeplink url which has # in the path

冷暖自知 提交于 2019-12-24 06:49:40

问题


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> 

but the terminal throwing message -

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

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


回答1:


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.

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



来源:https://stackoverflow.com/questions/44238121/why-android-does-not-handle-a-deeplink-url-which-has-in-the-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!