public interface

AppIndexApi

com.google.android.gms.appindexing.AppIndexApi

Class Overview

App Indexing API

Tell Google services what the user is viewing for history suggest in Google Search.

To use this API, do the following in your Activity:
 protected void onCreate(...) {
      mClient = new GoogleApiClient.Builder(getActivity())
          .addApi(AppIndex.APP_INDEX_API).build();
      ...
 }

 protected void onStart() {
     mClient.connect();
     AppIndex.AppIndexApi.view(mClient, this, viewIntent, title, webUrl, outLinks);
     ...
 }

 protected void onStop() {
     AppIndex.AppIndexApi.viewEnd(mClient, this, viewIntent);
     mClient.disconnect();
     ...
 }
 
 

Summary

Nested Classes
class AppIndexApi.AppIndexingLink An outbound link attached to viewed content. 
Public Methods
abstract PendingResult<Status> view(GoogleApiClient apiClient, Activity activity, Intent viewIntent, String title, Uri webUrl, List<AppIndexApi.AppIndexingLink> outLinks)
User viewed this content.
abstract PendingResult<Status> view(GoogleApiClient apiClient, Activity activity, Uri appIndexingUrl, String title, Uri webUrl, List<AppIndexApi.AppIndexingLink> outLinks)
User viewed this content.
abstract PendingResult<Status> viewEnd(GoogleApiClient apiClient, Activity activity, Uri appIndexingUrl)
User finished viewing this content.
abstract PendingResult<Status> viewEnd(GoogleApiClient apiClient, Activity activity, Intent viewIntent)
User finished viewing this content.

Public Methods

public abstract PendingResult<Status> view (GoogleApiClient apiClient, Activity activity, Intent viewIntent, String title, Uri webUrl, List<AppIndexApi.AppIndexingLink> outLinks)

User viewed this content. Should be called as soon as said content is visible. For instance, from onStart().

The intent specified must have a setData(Uri) specified. It must be stable and be handled by an exported Activity in the app.

Parameters
apiClient The GoogleApiClient. Client should be connecting or connected.
activity App's Activity where this content is viewed.
viewIntent Public Intent that goes back to this content.
title Title of the content.
webUrl Equivalent web url for the content. See App Indexing. Can be null.
outLinks List of outbound links on the page. Can be null.
Returns
  • PendingResult which can optionally be used to determine if the call succeeded.

public abstract PendingResult<Status> view (GoogleApiClient apiClient, Activity activity, Uri appIndexingUrl, String title, Uri webUrl, List<AppIndexApi.AppIndexingLink> outLinks)

User viewed this content. Should be called as soon as said content is visible. For instance, from onStart().

The intent specified must have a setData(Uri) specified. It must be stable and be handled by an exported Activity in the app.

Parameters
apiClient The GoogleApiClient. Client should be connecting or connected.
activity App's Activity where this content is viewed.
appIndexingUrl Deep link in the App Indexing format.
title Title of the content.
webUrl Equivalent web url for the content. See App Indexing. Can be null.
outLinks List of outbound links on the page. Can be null.
Returns
  • PendingResult which can optionally be used to determine if the call succeeded.

public abstract PendingResult<Status> viewEnd (GoogleApiClient apiClient, Activity activity, Uri appIndexingUrl)

User finished viewing this content. Should be called from onStop() in your app or as soon as the content is no longer visible to the user.

Parameters
apiClient The GoogleApiClient. Client should be connecting or connected.
activity App's Activity where this content is viewed.
appIndexingUrl Deep link in the App Indexing format.
Returns
  • PendingResult which can optionally be used to determine if the call succeeded.

public abstract PendingResult<Status> viewEnd (GoogleApiClient apiClient, Activity activity, Intent viewIntent)

User finished viewing this content. Should be called from onStop() in your app or as soon as the content is no longer visible to the user.

Parameters
apiClient The GoogleApiClient. Client should be connecting or connected.
activity App's Activity where this content is viewed.
viewIntent Public Intent that goes back to this content.
Returns
  • PendingResult which can optionally be used to determine if the call succeeded.