如何在Xamarin形式的Android和iOS中实现Deeplink(通用链接)? [英] How to Implement Deeplink(Universal Linking) In Xamarin forms Both Android and iOS?
问题描述
伙计们,我需要分步实现Android和iOS的Applink(通用链接),请帮助实现这一目标.我在android项目中尝试了以下代码
Guys, I need to implement Applink (Universal Link) step by step both android and iOS, please any to help achieve this. I tried the following code in my android project
我按照此URL编写了 https://devblogs.microsoft.com/xamarin/connect-with-your-users-with-google-search-and-app-indexing/
I followed this URL to write this https://devblogs.microsoft.com/xamarin/connect-with-your-users-with-google-search-and-app-indexing/
请注意,我不需要索引概念,只需从任何URL的点击中打开应用程序
Note I no need to indexing concept just want to open the app from Clicking of any URL
-
首先我安装了Xamarin.Forms.AppLinks NuGet
First I Installed Xamarin.Forms.AppLinks NuGet
下面的代码MainActivity
Below code MainActivity
[IntentFilter(new[] { Android.Content.Intent.ActionView },
Categories = new[]
{
Android.Content.Intent.CategoryDefault,
Android.Content.Intent.CategoryBrowsable
},
DataScheme = "http",
DataPathPrefix = "/",
DataHost = "test.com")]
- 然后在OnCreate方法中编写下面的代码
AndroidAppLinks.Init(this);
- 然后我尝试从Deep Link Tester中将深度链接URL称为"test://DeeplinkingSample"
说没有活动可以处理意图
Its saying No Activity found to handle the intent
推荐答案
4.然后,我尝试将Deeplink网址称为"test://DeeplinkingSample"来自深度链接测试器
4.Then I try to call deeplink url "test://DeeplinkingSample" from Deep Link Tester
它说没有活动可以处理意图
Its saying No Activity found to handle intent
您正在尝试调用URL test://DeeplinkSample
,其中包含以下部分
You are trying to call the URL test://DeeplinkSample
, which has the following parts
- 方案为
test
- 主机为
DeeplinkSample
- 无数据路径
- Scheme is
test
- Host is
DeeplinkSample
- No data path
但是,您没有为该URL注册活动,而是为方案http
注册了主机test.com
和数据路径前缀/
(即,所有以/
开头的数据路径) .因此,当您尝试打开应用程序时应该会打开
However, you did not register your activity for that URL, but for the scheme http
, with the host test.com
and the data path prefix /
(i.e. presumably all data paths that start with /
). Hence the app should open when you are trying to open
http://test.com/...
这篇关于如何在Xamarin形式的Android和iOS中实现Deeplink(通用链接)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!