如何在 Android 和 iOS 的 Xamarin 形式中实现 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 调用深层链接 URLtest://DeeplinkingSample"
它说没有找到处理意图的活动
Its saying No Activity found to handle the intent
推荐答案
4.然后我尝试调用深层链接网址test://DeeplinkingSample";来自 Deep Link Tester
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
- 没有数据路径
但是,您没有为该 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/...
这篇关于如何在 Android 和 iOS 的 Xamarin 形式中实现 Deeplink(通用链接)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!