How to implement APP indexing on Android

APP indexing is a relatively new concept that basically consists of a system that allows users access the contents of an app via Google search.

This lowers the barrier between webs and apps, allowing mobile users looking for related content for an app access the app directly from the results pages. But for this it is crucial to make sure that Google’s index can access the content in our app.

We will now describe the process to tell Google where the content of the app is and which URL links to it inside the web. This is called deep linking.

App Indexing for Android

The first thing we have to do to implement App Indexing on Android is to make sure that the app supports deep links. To do this there is an intent filter included in the file AndroidManifest.xml. An intent filter is a code to match an HTTP query or an URI scheme customized with its content.

An intent filter has an <action> tag that specifies the intention ACTION_VIEW so that it is possible to get to the filter from the Google search. The tag <data> indicates the format of the deep links. Lastly, a tag <category> with the intention BROWSABLE so that when clicking on a link on the browser, it redirects to the app.

Here you can see the code of an intent filter as well as more information about its implementation.

When the intent filter is implemented we have to associate each deep link with a URL of the website. There are different ways to do this:

  • Rel=alternate: do this including the deep link in the web page’s HTML code. Under the section <head> on each page we add a <link> element specifying the deep link.

Example:

<html>
<head>
<link rel=”alternate”
href=”android-app://{package_id}/{schema}/{host}/{pathPrefix}” />

</head>
<body> … </body>

  • XML Sitemap: an alternative to the previous method is to add the URI of the app to the file Sitemap.xml file to its equivalent URL of the website with the element <xhtml:link>.

This is how we would implement it:

<?xml version=”1.0″ encoding=”UTF-8″ ?>

<urlset xmlns=”http://www.sitemaps.org/schemas/sitemap/0.9″

xmlns:xhtml=”http://www.w3.org/1999/xhtml”>

<url>

<loc>http://{host}/{path_prefix}</loc>

<xhtml:link rel=”alternate” href=”android-app://{package_id}/{schema}/{host}/{path_prefix}” />

</url>

</urlset>

  • Schema.org: in Android we can also use the Schema.org. It is another alternative that consists in adding a fragment of code JSON+LD to define the relationship between each URL and the content of the app. Here you can see how this would be implemented:

<script type=”application/ld+json”>

“@context”: “http://schema.org”,

“@type”: “WebPage”,

“@id”: “http://{host}/{pathPrefix}”, “potentialAction”: {

“@type”: “ViewAction”, “target”: ” android-app://{ package_id}/{schema}/{host}/{pathPrefix}” } }

<script>

Warning! To activate App indexing on Android do not forget to connect your app to the website. For all this to work properly we have to link the web page to the app using Google Play Developer Console. You can find more information about the process here.

Testing and debugging

After we have completed the implementation we can check that the links to the content work properly using one of the following methods:

  • Android Debug Bridge: this is a tool that comes together with Android SDK and allows us to access and control a device from our PC.

If we run the tool on the commands console of Windows we can check if our links are correctly implemented. For this we use the following commands:

adb shell am start -a android.intent.action.VIEW -d “http://example.com/hi” com.example.android

adb shell am start -a android.intent.action.VIEW -d “example://hi” com.example.android

  • Link Test Tool: if we enter a deep link in the tool https://applinktest.appspot.com/ we will generate a QR code that we can scan with a compatible app. This is a way to ensure that the deep link is correct.

Calls to the API apps indexation can also result in errors. To ensure that there are no errors during this process we can do some of the following:

  • Use adb to register and check the data sent in the calls to API App Indexing. When we check the logs we can see the information about the calls to the API.
  • Use the tool “explore like Google”, accesible via Search Console, to debug any other error detected during the crawling process for the content of the app.
  • Crawling errors report: if Googlebot has problems accessing a content, the errors will appear on the crawling errors report of Search Console. This way we ensure that Google has been able to access the content of our app.
Rate this post
The following two tabs change content below.

Internet República

Somos una agencia de marketing digital especializada en SEO (posicionamiento en buscadores), gestión de reputación online (ORM), marketing de contenidos y Social Media. Ayudamos a darle visibilidad a tu marca en internet para que consigas, no solo atraer a tus potenciales clientes, sino también fidelizarlos.

Latest posts by Internet República (see all)