[英]Clicking on the web link app will open
I am trying to build an application where if I click the link my app(if installed) will open.But it's not working,don't know why.It's always redirecting to google.com 我正在尝试构建一个应用程序,如果我单击该链接,我的应用程序(如果已安装)将打开。但是它不起作用,不知道为什么。它总是重定向到google.com
My manifest file 我的清单文件
<activity android:name=".DeeplinkingActivity"
android:label="@string/app_name"
android:exported="true"
android:launchMode="singleTop"
android:theme="@android:style/Theme.Holo.NoActionBar">
<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" />
<!-- Accepts URIs that begin with "http://example.com/soham" -->
<data android:scheme="http"
android:host="example.com"
android:pathPrefix="/soham" />
<data android:scheme="http"
android:host="www.example.com"
android:pathPrefix="/soham" />
</intent-filter>
</activity>
My test.html 我的test.html
<a href="intent://scan/#Intent;scheme=http;package=soham.com.deeplinking;S.browser_fallback_url=http%3A%2F%2Fgoogle.com;end"></a>
I think the problem is in the html file.Any help? 我认为问题出在html文件中。有帮助吗?
Your link is incorrect, you are using the host of the Android Intents with Chrome example . 您的链接不正确,您使用的是带有Chrome的Android Intents示例的主机。 You need to use the
host
and pathPrefix
configured in the AndroidManifest.xml
. 您需要使用
AndroidManifest.xml
配置的host
和pathPrefix
。
Your host
is example.com
and your pathPrefix
is /soham
, the link will become: 您的
host
是example.com
,您的pathPrefix
是/soham
,链接将变为:
<a href="intent://example.com/soham#Intent;scheme=http;package=soham.com.deeplinking;S.browser_fallback_url=http%3A%2F%2Fgoogle.com;end">Deeplink</a>
Try this: This is working for my app: 试试这个:这适用于我的应用程序:
NOTE: write below code within your launcher activity tag 注意:在启动器活动代码中编写以下代码
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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" />
<!-- Accepts URIs that begin with "example://WRITE YOUR HOST NAME” -->
<data
android:host="index.html"
android:scheme="WRITE YOUR HOST NAME" />
</intent-filter>
<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" />
<!-- Accepts URIs that begin with "http://example.com/WRITE YOUR HOST NAME” -->
<data
android:host="WRITE YOUR HOST NAME.com"
android:pathPrefix="/index.html"
android:scheme="http" />
</intent-filter>
<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="WRITE YOUR HOST NAME" />
</intent-filter>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.