com.google.android.gms.appindexing.AppIndexApi |
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 yourActivity
:
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();
...
}
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AppIndexApi.AppIndexingLink | An outbound link attached to viewed content. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
User viewed this content.
| |||||||||||
User viewed this content.
| |||||||||||
User finished viewing this content.
| |||||||||||
User finished viewing this content.
|
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.
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. |
PendingResult
which can optionally be used to determine if the call
succeeded.
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.
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. |
PendingResult
which can optionally be used to determine if the call
succeeded.
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.
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. |
PendingResult
which can optionally be used to determine if the call
succeeded.
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.
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. |
PendingResult
which can optionally be used to determine if the call
succeeded.