如何在Xamarin形式的Android和iOS中实现Deeplink(通用链接)? [英] How to Implement Deeplink(Universal Linking) In Xamarin forms Both Android and iOS?

查看:259
本文介绍了如何在Xamarin形式的Android和iOS中实现Deeplink(通用链接)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们,我需要分步实现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

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

  1. 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")]

  1. 然后在OnCreate方法中编写下面的代码

  AndroidAppLinks.Init(this);

  1. 然后我尝试从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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆