public interface

AppIndexApi

com.google.android.gms.appindexing.AppIndexApi

Class Overview

Provides methods for indexing actions that users are performing in your app to Google.

This API can be used to personalize users' Google Search experience based on usage of your app.

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

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

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

Summary

Nested Classes
interface AppIndexApi.ActionResult Represents the result of writing an Action
class AppIndexApi.AppIndexingLink An outbound link attached to viewed content. 
Public Methods
abstract AppIndexApi.ActionResult action(GoogleApiClient apiClient, Action action)
Indicates that the user has performed a specific action in your app.
abstract PendingResult<Status> view(GoogleApiClient apiClient, Activity activity, Intent viewIntent, String title, Uri webUrl, List<AppIndexApi.AppIndexingLink> outLinks)
This method is deprecated. Use view(GoogleApiClient, Activity, Uri, String, Uri, List) instead.
abstract PendingResult<Status> view(GoogleApiClient apiClient, Activity activity, Uri appIndexingUrl, String title, Uri webUrl, List<AppIndexApi.AppIndexingLink> outLinks)
Indicates that the user is viewing a piece of content in the app.
abstract PendingResult<Status> viewEnd(GoogleApiClient apiClient, Activity activity, Uri appIndexingUrl)
Indicates that the user has stopped viewing a piece of content in the app.
abstract PendingResult<Status> viewEnd(GoogleApiClient apiClient, Activity activity, Intent viewIntent)
This method is deprecated. Use viewEnd(GoogleApiClient, Activity, Uri) instead.

Public Methods

public abstract AppIndexApi.ActionResult action (GoogleApiClient apiClient, Action action)

Indicates that the user has performed a specific action in your app.

Parameters
apiClient The GoogleApiClient configured to use the API. The client should be connecting or connected.
action The Action performed by the user within the app.
Returns

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

This method is deprecated.
Use view(GoogleApiClient, Activity, Uri, String, Uri, List) instead.

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

Indicates that the user is viewing a piece of content in the app. Call this method when the content becomes visible (for example, from the onStart() handler).

The Activity registered to handle the specified appIndexingUrl must be stable and exported in the app.

Parameters
apiClient The GoogleApiClient configured to use the API. The client should be connecting or connected.
activity The app's Activity where this content is viewed.
appIndexingUrl The deep link in the App Indexing format.
title The title of the content.
webUrl The equivalent web url for the content. See App Indexing. Can be null.
outLinks The list of outbound links on the screen. Can be null.
Returns
  • The PendingResult which can optionally be used to determine if the call succeeded.

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

Indicates that the user has stopped viewing a piece of content in the app. Call this method when the content becomes hidden from the user (for example, from the onStop() handler).

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

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

This method is deprecated.
Use viewEnd(GoogleApiClient, Activity, Uri) instead.