Google Cloud Speech API examples
This directory contains Android example that uses the Google Cloud Speech API.
Enable the Speech API
If you have not already done so, enable the Google Speech API for your project. You must be whitelisted to do this.
Set Up to Authenticate With Your Project's Credentials
This Android app uses JSON credential file locally stored in the resources. You should not do this in your production app. Instead, you should set up your own backend server that authenticates app users. The server should delegate API calls from your client app. This way, you can enforce usage quota per user. Alternatively, you should get the access token on the server side, and supply client app with it. The access token will expire in a short while.
In this sample, we just put the Service Account in the client for ease of use. The app still gets an access token using the service account credential, and use the token to call the API, so you can see how to do so.
In order to try out this sample, visit the Cloud Console, and
API Manager > Credentials > Create credentials > Service account key > New service account.
Create a new service account, and download the JSON credentials file. Put the file in the app
Again, you should not do this in your production app.
See the Cloud Platform Auth Guide for more information.
Before running tests update the following environment variable with the service account:
This environment variable will be used to update the service account used here
Run tests by using:
Build signed release
This step is optional.
This sample uses ProGuard to decrease the number of methods generated by the gRPC library. It is enabled by default for release build. If you want to build it, change the path, alias and passwords of the keystore file specified in gradle.properties.