20

I would like to enable App Indexing for my cordova android app as explained here: https://developers.google.com/app-indexing/webmasters/app

Unfortunately I can't find documentation how to do that for a cordova app. 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

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:

error: Error parsing XML: unbound prefix

This error disappears when removing the android: prefixes within the XML, but it isn't working.

Mihai Ionescu
  • 2,108
  • 1
  • 12
  • 15
Riesling
  • 6,343
  • 7
  • 29
  • 33
  • 1
    *[Phonegap Build](https://build.phonegap.com/)* has a method to add XML elements to the final AndroidManifest.xml It is called `gap:config-file` http://docs.build.phonegap.com/en_US/configuring_config_file_element.md.html#Config%20File%20Elements –  Oct 27 '15 at 00:51
  • Is the question related to this discussion on the dev list? http://callback.markmail.org/thread/e6fkurnkisekwgmu – daserge Nov 13 '15 at 10:38
  • yes, looks like it I think this plugin might be of help: https://github.com/nordnet/cordova-universal-links-plugin – Riesling Nov 13 '15 at 12:37
  • @Riesling, have you tried that plugin? If it worked you can answer to your own question to make it more visible to the people (the question is high rated). – daserge Nov 25 '15 at 11:14
  • Possible duplicate of [How to provide and handle deep links in cordova / phonegap applications](http://stackoverflow.com/questions/25072373/how-to-provide-and-handle-deep-links-in-cordova-phonegap-applications) – Ivan Gabriele Jun 15 '16 at 01:38

4 Answers4

1

I have looked into this before and there are some problems with Google App Indexing and 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.

Somebody needs to implement a plugin for this, to simulate all the views, and you would still need to make some calls from Javascript. Android simply does not know how the App is structured behind the 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. But I am not sure if google will index content in an InAppBroser anyhow.

I am using this plugin to get the url opening functionality 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.

Paul Weber
  • 6,518
  • 3
  • 43
  • 52
  • In my case I'm loading a mobile site within the inappbrowser (the app is just a wrapper to add some additional features like push notifications), therefore I don't have this problem. – Riesling Jan 19 '16 at 10:03
1

With this plugin I got it implemented successfully:

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. Then you can add some additional markup to the sites, which should be indexed, to help Google finding the right links. The documentation is good.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
Riesling
  • 6,343
  • 7
  • 29
  • 33
0

wrote a little plugin for it: 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

Have fun! Enes

eneskaya
  • 918
  • 1
  • 10
  • 17
-1

cordova-plugin-firebase-appindexing plugin helps to index your app in google.

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. 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

OK200
  • 727
  • 6
  • 22