Publish Your Deep Links

Google Search needs to both discover and understand your app in order to serve your deep links in Search results, provide query auto-completions, and deliver Now on Tap to your users. The process of publishing your deep links involves the following steps:

  • Either use the App Indexing API or allow Googlebot to access your app
  • Host your links
  • Support Google Search quality guidelines

Use the App Indexing API

The first step to publishing your deep links is to use our API, which is part of the core offering in Google Play Services. The App Indexing API lets you annotate the content and capabilities of your app, so that when our systems discover the content URLs referenced from your website or sitemap, we can provide a meaningful title and an appropriate deep link. For example, you typically implement the API to respond to view activities for content in your app, but you can also use the API to describe other kinds of activity within your app, such as System Voice Actions. Once you implement the API for your app content, Google can also surface the content to users via query autocompletions from the Google app. Users can view and delete past activity in apps at https://history.google.com/.

To implement the API for your app, you'll do the following:

  • Add Google Play services to your project
  • Modify activities that support deep links

Add Google Play services

Make sure your project includes Google Play Services and update your configuration as shown below:

  <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
dependencies {
  compile 'com.google.android.gms:play-services-appindexing:8.1.0'

Modify activities that support deep links

For each activity that supports deep links, send the page title and the actions taken by the user on that activity so we can better surface your content and capabilities in Search. Here's a common modification workflow scenario:

  1. Create an instance of GoogleApiClient in the onCreate() method of your activity.
  2. Generate an Action object with the newAction() helper convenience method.

    This object represents the type of activity taken in your app by the user, and it also includes the page title and relevant URLs for the content. If there is no corresponding web content, you can pass in null. You can also use the more generic methods on Action.Builder to create an action with a description and other rich metadata.

    See the App Indexing API Reference for details on supported actions and helper classes.

  3. Indicate activity start with the AppIndexApi.start() method, passing in the Action object you created above.
  4. Use AppIndexApi.end() when the user completes the action.
  5. Disconnect your client in your onStop() method.

The sample below illustrates how you'd modify the deep link activities in your app to annotate information about that activity. The Action object contains the title of the content, which can appear in Google app query autocompletions. It also contains the deep link leading users to the specific app page, and the web URL for any corresponding web content. Here, AppIndexApi.start() method accepts the action performed by the user within the app.

Typically, you'll set this up within the onStart() and onStop() methods of your app, but it's not strictly necessary, such as when sending fragments or other scrolling-type UIs.


import com.google.android.gms.appindexing.Action;
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.example.android.recipes/http/recipe-app.com/recipes");
  static final Uri WEB_URL = Uri.parse("http://recipe-app.com/recipes/");
  private GoogleApiClient mClient;

  protected void onCreate(Bundle savedInstanceState) {
    mClient = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();

  public void onStart() {

    // Connect your client

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

    // Construct the Action performed by the user
    Action viewAction = Action.newAction(Action.TYPE_VIEW, title, WEB_URL, APP_URI);

    // Call the App Indexing API start method after the view has completely rendered
    AppIndex.AppIndexApi.start(mClient, viewAction);

  public void onStop() {
    // Call end() and disconnect the client
    String title = "App Indexing API Title";
    Action viewAction = Action.newAction(Action.TYPE_VIEW, title, WEB_URL, APP_URI);
    AppIndex.AppIndexApi.end(mClient, viewAction);


Follow best practices

  • Only call the AppIndexApi.start() method once each time the user explicitly chooses to view some content.
  • Allow the view to finish rendering before calling AppIndexApi.start()
  • There should be an existing deep link in the app for each API call.
  • Use an accurate and descriptive title for your Action. The text defined in this title may be used in the Google app query autocompletions. See this Help Forum article for a more detailed guide on how to write a good title.
  • If users are interacting with content in the app, and not just viewing it, make sure to set an appropriate type for the Action (for example Action.TYPE_LISTEN.)

Allow access by Googlebot (optional)

In general, your app should allow access to its content by Googlebot. If you do not use the App Indexing API to describe your deep links, this is a required alternative. Your app will need to make any HTTP requests that it usually makes under normal operation, and these requests will appear to your servers as originating from Googlebot.

If you already have a robots.txt and do not use the App Indexing API to publish your deep links, you will need to configure the robots.txt to allow access by Google:

User-Agent: Googlebot
Allow: /

This statement allows Googlebot to crawl your app content without the typical restrictions that you might have for real users, such as Terms of Service screens, End User License Agreements (EULAs), or welcome screens. If the Googlebot is unable to get to content due to these kinds of restrictions, we won't be able to index your app (unless you instead use the App Indexing API).

Host your links

After you've either integrated your app with the API or allowed Googlebot to crawl your app content (optional), you're ready to make the content discoverable by our systems.

Associate your app to your site (HTTP deep links)

If your app supports HTTP deep links, associate it with your website. That's it! You won’t have to update a sitemap or add webpage markup. After your app content is indexed, your deep links can appear in Google search results, query autocompletions, and Now on Tap. You'll also be able to analyze Search impressions and clickthrough rates for your app content.

To make the association, you must be a verified app publisher in Google Play. For details on app publishing, see Get Started with Publishing on the Android Developer's site.

You can make the association from either the Developer Console or the Search Console.

  • From the Developer Console: Request to verify your website. This sends a message to your webmaster to associate your app to your site. See App Indexing on Google Search for more details.
  • From Search Console: Go to Associate a Website, choose your app from the list, and enter the URL of the site or sites you want to associate with the app.

As soon as you make the association between your website and app, you can use Fetch as Google to see how your app appears to our systems.

After that, Google will automatically start indexing any existing or new HTTP deep links to your app. Our systems use URLs discovered through web indexing that match the intent-filter patterns in your AndroidManifest.xml file. You'll be notified of any errors from crawling your app content and be able to use the simple debugging workflow in Search Console.

Hosting custom scheme deep links

If your app is using a custom URI scheme, you can still participate in App Indexing by specifying which deep links correspond to your web pages using rel=alternate elements in your sitemap or webpages, or by using schema.org markup. See Supported Deep Link Methods for details.

The app deep links you provide through one of the methods above specifies an alternate URI that can be used to open the content in your app from a web page. It helps to first collect and define the page-to-app mappings, making sure you use the correct format for the app URIs:



  • package_name: application ID as specified in the Android Play Store.
  • scheme: the scheme to pass to the application. Can be HTTP, or a custom scheme.
  • host_path: identifies the specific content within your application.

Let's say the package name for the example.com app is com.example.android. The following table shows both HTTP and custom scheme URIs along with the target app URI.

Source URL Target "android-app" URL
http://example.com/gizmos?1234 android-app://com.example.android/http/example.com/gizmos?1234
http://example.com/gizmos/1234 android-app://com.example.android/http/example.com/gizmos/1234
http://example.com/gizmos/toys/1234 android-app://com.example.android/http/example.com/gizmos/toys/1234
example://gizmos?1234 android-app://com.example.android/example/gizmos?1234
example://gizmos/1234 android-app://com.example.android/example/gizmos/1234
example://gizmos/toys/1234 android-app://com.example.android/example/gizmos/toys/1234

Support Google Search quality guidelines

In order to ensure a great search experience for users, Google may take corrective action in cases where we see abuse, deception, or other actions that hurt the search experience for users. This can include actions such as demoting or removing your app deep links from Google Search results.

Next, you can test your implementation.

Send feedback about...

App Indexing