com.google.android.gms.appindexing.AppIndexApi |
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 yourActivity
:
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();
...
}
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AppIndexApi.ActionResult |
Represents the result of writing an Action .
|
||||||||||
AppIndexApi.AppIndexingLink | An outbound link attached to viewed content. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Indicates that the user has performed a specific action in your app.
| |||||||||||
This method is deprecated.
Use
view(GoogleApiClient, Activity, Uri, String, Uri, List) instead.
| |||||||||||
Indicates that the user is viewing a piece of content in the app.
| |||||||||||
Indicates that the user has stopped viewing a piece of content in the app.
| |||||||||||
This method is deprecated.
Use
viewEnd(GoogleApiClient, Activity, Uri) instead.
|
Indicates that the user has performed a specific action in your app.
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. |
AppIndexApi.ActionResult
containing the result of writing an Action
.
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.
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. |
PendingResult
which can optionally be used to determine if the call
succeeded.
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).
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. |
PendingResult
which can optionally be used to determine if the call
succeeded.