App Indexing API

The App Indexing API provides a way for developers to notify Google about deep links in their native apps and allows the Google app, version 3.6 and above, to drive re-engagement through Google Search query autocompletions, providing fast and easy access to inner pages in apps. The deep links reported using the App Indexing API are also used by Google to index app content and are surfaced in Google Search results.

Overview of the App Indexing API

In this video, product manager Lawrence Chang presents an overview of the new App Indexing API for Android that lets you specify links -- through your app itself -- for App Indexing. It also gives you a way to re-engage users through the Google app autocompletions. We'll provide step-by-step guidelines for how to get started. Take a few minutes and find out how to increase user engagement using the App Indexing API.

Using the API

In order to integrate the App Indexing API into your app, you will first need to set up your project to include Google Play Services. Please be sure to update your project configuration as shown in the examples below:



  <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />


build.gradle (if using Android Studio)

dependencies {

  compile 'com.google.android.gms:play-services-appindexing:6.5.87'


Once your project is configured to use Google Play Services API, follow these steps for any activity that supports deep links:

  1. Create an instance of GoogleApiClient in the onCreate() method of your activity.
  2. Notify Google each time a new activity is viewed using the AppIndexApi.view() method. This can be called in the onStart() method of each activity. The view() should report the content that the user is currently looking at in your app. When that content changes, and the user is looking at something else, the app should call viewEnd() on the exiting content and then view() for the new content that is shown. The usual way this works is with onStart() and onStop() but it need not in the case of fragments or other scrolling-type UIs, for example.
  3. Disconnect your client in your onStop() method.


import com.google.android.gms.appindexing.AppIndex;
import com.google.android.gms.common.api.GoogleApiClient;


public class MainActivity extends Activity {

  static final Uri APP_URI = Uri.parse("android-app://com.google.developers/appindexingdemo/restaurant1/");
  static final Uri WEB_URL = Uri.parse("http://appindexingdemo.google.com/restaurant1/");
  static final Uri EMPTY_WEB_URL = Uri.parse("");
  private GoogleApiClient mClient;

  protected void onCreate(Bundle savedInstanceState) {

    mClient = new GoogleApiClient.Builder(this).addApi(AppIndex.APP_INDEX_API).build();


  public void onStart(){

    // Connect your client

    // Define a title for your current page, shown in autocompletion UI
    final String title = "App Indexing API Title";

    // Call the App Indexing API view method after the view has completely rendered
    AppIndex.AppIndexApi.view(mClient, this, APP_URI, title, WEB_URL, null);


  public void onStop(){

    // Call viewEnd() and disconnect the client
    AppIndex.AppIndexApi.viewEnd(mClient, this, APP_URI);


The AppIndexApi.view() method accepts the title of the Activity as well as the deep link that can take users directly to the current view of the app. The title provided here will be used in the Google app query autocompletions. If there is corresponding web content, the web URL parameter should be passed in as well.

However, it is optional to pass the web URL parameter. If there is no corresponding web URL for the app content being reported you should pass EMPTY_WEB_URL parameter, as opposed to a null value.

Also see the AppIndexApi reference documentation for details.

Quality Guidelines

Google may take corrective action (e.g., demoting or removing your app deep links from Google Search results and query autocompletions) in cases where we see abuse, deception, or other actions that hurt the search experience for our users. In particular, you should avoid:

  • Calling the API on content the user is not viewing.
  • Calling the API more than once per user view.
  • Calling the API with a title that is misleading or incorrect.

Note that Google may react to other misleading practices not listed here. The examples above are not exhaustive. Google may take action on other practices or techniques that hurt the search experience.

Finally, once you have done everything in the launch checklist, Google will be able to start indexing your app. You can check for any issues that arise in Webmaster Tools.