Mike Mukul

Mike Mukul

Mobile App Indexing: How to do it

A technical guide to Google’s mobile app indexing

In our last blog(Mobile App Indexing: What is it?), we talked about some great benefits of Mobile App Indexing for gaining new users and re-engaging existing users. Now we are going to discuss the technical details of connecting your website and your client’s mobile app.

Mobile App Indexing is one easy way to solve the problem of user engagement. It gives users the option to visit a site to find the information or open the related mobile app installed on the devices when they search from their mobile device. The apps which have mobile app indexing implemented shows an install/open button in the search result which allows the users to install or open the existing app for the same information.

Let’s look at the technical requirements to make this connection possible. We are going to focus on how to work in an Android environment, as the iOS environment has a few differences.

Technical requirements

  1. The app should be developed using the minimum SDK version higher than 17.
  2. This only works for Android Chrome 4.1+ and Google app 2.8+.
  3. You should be logged in with your Google account on your phone.

How to get your Mobile App Indexed?

To get your mobile app indexed you must configure your website and your mobile app to establish a relationship between the app and the site in two steps:

  1. Your mobile app should support Deep Links by adding intent filters in your mobile app manifest file to find the related content within the mobile app.
  2. Deep Links must be published on your website (or through sitemap) for every page.

What are Deep Links?

Deep linking is a method of opening an installed application by using a button or link from a mobile device. It connects to a specific URL and opens the relevant specific screen of the installed mobile application. It is very similar to how you define a link in your website. For example:

Link to a page on website

  • https://www.purdueguru.com/search

Link to a screen in your mobile app

  • purdueguru://search

Determine the Deep Links

To deep link the mobile app you first need to identify the content which is similar on both the website and the mobile app. We need to connect this content within the app so that user will see the exact screen of the app instead of a launcher or a splash screen of the app as the first page. This allows a user to go directly to the relevant information within an app. We do not need to finalize the URL Schema for those links.

Setting up Deep Linking in the Android App

To setup deep linking in the android app we must create intent filters which register a URL in the data element. Your intent filter should contain three elements

  • Action
  • Data
  • Category

Below is a sample of intent filters which should be placed inside the app manifest file to enable the deep linking.

<activity
  android:name="com.pg.android.SearchActivity"
  android:label="@string/title_search" >
    <intent-filter android:label="@string/filter_title_search">
       <action android:name="android.intent.action.VIEW" />
       <category android:name="android.intent.category.DEFAULT" />
       <category android:name="android.intent.category.BROWSABLE" />
       <data android:scheme="purdueguru"
         android:host="search"
        />
    </intent-filter>
</activity>

Handle the Intent Filter

You have to call getIntent() method in onCreate of your activity to verify the action, it should be an Action View. See a sample snippet below.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Intent intent = getIntent();
    String action = intent.getAction();

    //Verifying the Action View
    if (action == Intent.ACTION_VIEW) {
       
      Uri data = intent.getData();
      if (data !=null)
      {  // Add your logic here if found  }
      else
      {  //Handle the code if data is null  }
    }
}

Check the Deep Links

To test the deep link you can use Android ADB (Android Debug Bridge). This helps you to check the intent filter URLs which you have specified above in your deep linking. ADB commands can be run via the console/shell.

Below is an example:

$ adb shell am start -W -a android.intent.action.VIEW -d "purdueguru://search" com.pg.android

Indexing your App Content

Google Bots are constantly crawling and indexing your client’s website for Google search. To allow the bots to index your client’s android app content and crawl your APK in the Google Play Store, you must add the links to the head element of each page or existing sitemap file as usually done for a website. The deep links should be in the following format.

android-app://<package_name>/<protocol>/<host_path>

Note: Protocol or Scheme defined in your internet filter.

Example:

android-app://com.pg.android/purdueguru/search
  • package_name: Package Name in APK.
  • protocol.  Intent filter scheme.
  • host_path. look for the content within the app.

Let’s review the example sitemap to add the deep link. The <xhtml:link> tag is used to add the deep link into the sitemap file.

<?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>purdueguru://search</loc> 
        <xhtml:link
 
          rel="alternate" 
          href="android-app://com.pg.android/purdueguru/search" />
    </url>
</urlset>

Changes to add into the website for App Indexing

Instead of adding the deep link into your sitemap you can also add these directly into your website. Once you add the markups into the web pages, google bots can see those in HTML and use those deep links to identify the relevant app and redirect the user to the relevant screen within the app.

<html>
<head>
    <link rel="alternate" href="android-app://com.pg.android/purdueguru/search" />
</head>
<body>
<!-- your page body -->
</body>

After this, you need to allow Google to crawl the URLs from your robots.txt file and wait. Google with link your app and your site, so that you can reap all of the rewards of mobile app indexing.

In these two blogs, we have discussed the benefits and the technical requirements to utilize mobile app indexing. When building mobile apps for your clients, utilize this powerful tool to help grow and retain your client’s user base.

Need help in mobile app indexing? We would love to help. Contact: solutions@ithands.com

Let’s Work Together

Subscribe to our blog: