public interface

SearchAuthApi

com.google.android.gms.search.SearchAuthApi

Class Overview

API for Google Search auth.

Usage example:

 SearchAuthApi searchAuthApi = SearchAuth.SearchAuthApi;
 GoogleApiClient client = new GoogleApiClient.Builder(context)
         .addApi(SearchAuth.API)
         .build();
 client.connect();

 try {
     // Invoke methods of searchAuthApi.
 } finally {
     client.disconnect();
 }
 
 

Summary

Nested Classes
interface SearchAuthApi.GoogleNowAuthResult Result of getGoogleNowAuth(GoogleApiClient, String)
Public Methods
abstract PendingResult<SearchAuthApi.GoogleNowAuthResult> getGoogleNowAuth(GoogleApiClient client, String webAppClientId)
Obtains authorization for the caller to use the Now API to publish to the Google Now user, if any, on this device.

Public Methods

public abstract PendingResult<SearchAuthApi.GoogleNowAuthResult> getGoogleNowAuth (GoogleApiClient client, String webAppClientId)

Obtains authorization for the caller to use the Now API to publish to the Google Now user, if any, on this device.

Usage example:

 SearchAuthApi.GoogleNowAuthResult authResult;
 try {
     authResult = searchAuthApi.getGoogleNowAuth(client, WEB_APP_CLIENT_ID)
             .await();
 } finally {
     client.disconnect();
 }

 Status status = authResult.getStatus();
 if (status.isSuccess()) {
     GoogleNowAuthState authState = authResult.getGoogleNowAuthState();
     if (authState.getAuthCode() != null) {
         // Send auth code to your server and from your server obtain OAuth refresh
         // and access tokens.
     } else if (authState.getAccessToken() != null) {
         // Already obtained auth code before. To get a new auth code revoke this
         // token and retry.
     }
 }
 
 

Parameters
client GoogleApiClient that includes API.
webAppClientId Client ID, in the Google Developer Console, of the web application that will be using the Now API.
Returns