c# - 如何在 Xamarin forms Android 和 iOS 中实现 Deeplink(Universal Linking)?

标签 c# xamarin.forms xamarin.android xamarin.ios

伙计们,我需要在 android 和 iOS 上逐步实现 Applink(通用链接),请任何人帮助实现这一点。我在我的android项目中尝试了以下代码

我按照这个 URL 写了这个 https://devblogs.microsoft.com/xamarin/connect-with-your-users-with-google-search-and-app-indexing/

注意我不需要索引概念只是想通过点击任何 URL 打开应用程序

  1. 首先我安装了 Xamarin.Forms.AppLinks NuGet

  2. MainActivity 代码下方

[IntentFilter(new[] { Android.Content.Intent.ActionView },
        Categories = new[]
        {
            Android.Content.Intent.CategoryDefault,
            Android.Content.Intent.CategoryBrowsable
        },
        DataScheme = "http",
        DataPathPrefix = "/",
        DataHost = "test.com")]
  1. 然后在OnCreate方法中编写如下代码
  AndroidAppLinks.Init(this);
  1. 然后我尝试从深层链接测试器调用深层链接 URL“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,它包含以下部分

  • 方案是测试
  • 宿主是DeeplinkSample
  • 没有数据路径

但是,您没有为该 URL 注册您的事件,而是为方案 http,主机 test.com 和数据路径前缀 /(即可能所有以 / 开头的数据路径)。因此,当您尝试打开应用时,该应用应该会打开

http://test.com/...

关于c# - 如何在 Xamarin forms Android 和 iOS 中实现 Deeplink(Universal Linking)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59926139/

相关文章:

c# - 在Unity3d中连接MySql -> NullReferenceException : Object reference not set to an instance of an object

c# - 更改 WebBrowser 控件的用户代理

c# - 使用复选框在 ListBox 中加载数据

ios - 如何使分组的 ListView 标题在 iOS 中正确 float (不粘)?

xamarin.android - MonoDroid 的 MvvmCross - 如何绑定(bind)到菜单项单击事件

c# - WCF 服务主机关闭被打开的 session 阻止并且设置 receiveTimeout 没有帮助

c# - GestureRecognizer 不适用于 ios xamarin.forms

Xamarin 表格 : getting the Invalid update: invalid number of rows in section 0 in iOS

c# - 在 Xamarin 中将内容页面转换为导航页面

android - Xamarin Google Play 服务丢失?