Kotlin Client Examples

October 24, 2018 ยท View on GitHub

Examples of using the Kgen code generator to generate Google Cloud client libraries in Kotlin.

Running

To run the samples in this repository you must have a Google Cloud project that you can use. To get started:

  1. Create a project, if you don't already have one
  2. Enable billing for your project
  3. Enable the APIs that the examples use:
  4. Create a new service account with a JSON keyfile
  5. Move the service account JSON file to app/src/main/res/raw/sa.json

After your Google Cloud project is setup you are ready to run the examples. Each example is a single Activity that calls an API and puts a stringified version of the result on the UI.

To switch between examples, modify the sample application's manifest app/src/main/AndroidManifest.xml and change the main activity (i.e. move the intent-filter under the example that you want to run).

Note: You should not normally put a service account keyfile in an application that will be distributed. It is done in these examples for simplicity but not should not be done in real applications.