[英]Add deep linking to cordova app
I would like to enable App Indexing for my cordova android app as explained here: https://developers.google.com/app-indexing/webmasters/app 我想为我的cordova Android应用启用App Indexing,如下所述: https : //developers.google.com/app-indexing/webmasters/app
Unfortunately I can't find documentation how to do that for a cordova app. 不幸的是我无法找到如何为cordova应用程序执行此操作的文档。 There is a plugin to listen and broadcast to Intents, but I don't think this will help me in this case: https://github.com/Initsogar/cordova-webintent 有一个插件可以收听并向Intents广播,但我不认为这会对我有所帮助: https : //github.com/Initsogar/cordova-webintent
I tried to add the example XML (modified with my data) to the config.xml file, but when I try to build the app I get the following error: 我尝试将示例XML(使用我的数据修改)添加到config.xml文件中,但是当我尝试构建应用程序时,我收到以下错误:
error: Error parsing XML: unbound prefix
This error disappears when removing the android: prefixes within the XML, but it isn't working. 删除XML中的android:前缀时,此错误消失,但它无法正常工作。
I have looked into this before and there are some problems with Google App Indexing and Cordova Applications. 我之前已经研究过这个问题,Google App Indexing和Cordova Applications存在一些问题。 Since Cordova, by design, works in a single web view, there is not much to index - the App Indexing feature will just wonder why you are staying in one view all the time. 由于Cordova按照设计在一个Web视图中工作,因此没有太多索引 - 应用程序索引功能只会想知道为什么您一直都在一个视图中。
Somebody needs to implement a plugin for this, to simulate all the views, and you would still need to make some calls from Javascript. 有人需要为此实现一个插件,以模拟所有视图,你仍然需要从Javascript进行一些调用。 Android simply does not know how the App is structured behind the Web View. Android根本不知道应用程序是如何在Web View后面构建的。
What might help is to add some Intents so your App can be started in response to some links on your website or links eg in an email or web browser with a special yourapp:// protocol. 可能有帮助的是添加一些意图,以便您的应用程序可以启动以响应您网站上的某些链接或链接,例如在具有特殊yourapp://协议的电子邮件或Web浏览器中。 But I am not sure if google will index content in an InAppBroser anyhow. 但我不确定谷歌是否会在InAppBroser中索引内容无论如何。
I am using this plugin to get the url opening functionality https://github.com/EddyVerbruggen/Custom-URL-scheme 我正在使用这个插件来获取网址开放功能https://github.com/EddyVerbruggen/Custom-URL-scheme
I myself am looking for a solution, so if somebody else has a better answer I would be happy to upvote it. 我自己正在寻找一个解决方案,所以如果其他人有更好的答案,我很乐意对它进行投票。
With this plugin I got it implemented successfully: 有了这个插件,我成功实现了它:
https://github.com/nordnet/cordova-universal-links-plugin https://github.com/nordnet/cordova-universal-links-plugin
You need to add it to your project and then configure you're sites via <link rel="alternate" href="" />
elements in a config file. 您需要将其添加到项目中,然后通过配置文件中的<link rel="alternate" href="" />
元素配置您的站点。 Then you can add some additional markup to the sites, which should be indexed, to help Google finding the right links. 然后,您可以向网站添加一些额外的标记,这些标记应编入索引,以帮助Google找到正确的链接。 The documentation is good. 文档很好。
wrote a little plugin for it: https://github.com/eneskaya/google-app-indexing-cordova 为它写了一个小插件: https : //github.com/eneskaya/google-app-indexing-cordova
The first step still remains to enable deeplinking to your app though! 第一步仍然是启用深层链接到您的应用程序! I recommend https://github.com/EddyVerbruggen/Custom-URL-scheme 我推荐https://github.com/EddyVerbruggen/Custom-URL-scheme
Have fun! 玩得开心! Enes 埃内斯
cordova-plugin-firebase-appindexing plugin helps to index your app in google. cordova-plugin-firebase-appindexing插件有助于在谷歌索引你的应用程序。
You can index the app pages with meta tags as mentioned here . 您可以使用此处提到的元标记索引应用页面。
Plugin helps to search your app pages in google search application in Android app. 插件有助于在Android应用中的Google搜索应用中搜索您的应用页面。 If you search for app pages it comes in auto complete and on click of search result it takes directly to your app page. 如果您搜索应用页面,它会自动完成,点击搜索结果会直接进入您的应用页面。
https://www.npmjs.com/package/cordova-plugin-firebase-appindexing https://www.npmjs.com/package/cordova-plugin-firebase-appindexing
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.