App Inventor and Fusiontables

How to use the Service account option to connect to a Fusion Tables Fusiontable

Thank you Steven for being the sponsor of this tutorial!

Precondition: you already have done the Pizza Party tutorial and you already created a fusiontable, which means, you already have a table id.

There is one major disadvantage using the fusiontables as described in the Pizza Party tutorial, which is: To share a FusionTable with others, you have to share it with each person individually, or you can share with a Google Group, the same way you would share a private google doc. There is no way to share write privileges to a FusionTable with the public. Public access is restricted to read-only.

To avoid this disadvantage, just use the service account option. There are the following steps for the setup:


  1. Developers Console: create a Service Account. After creating a service account in the developer console you get a p12 file to download and a service account email to use in App Inventor.
  2. FusionTable: share the FusionTable with the ServiceAccount Email address and set the permissions to "can edit".
  3. App Inventor: The p12 file must be uploaded as asset into App Inventor and this is the file referenced to in the Keyfile property, see also screenshot of the App Inventor Blocks editor below.

Detailed steps including screenshots

Note: These detailed steps have been updated on Nov. 22nd, 2015. Unfortunately Google changes the user interface frequently, which means, the steps to do are still the same, only the user interface looks a little bit different now.

1. Google Developers Console

  1. Open the Google Developers Console and create a new project, just click "Create Proejct".
  2. Enter a project name (do not use spaces in the project name to avoid spaces in the file name later), use the suggested project id and click "Create".

    The project will be created.
  3. Then in the Project Dashboard click onto "Enable and manage APIs"
  4. Disable all APIs and enable the Fusiontables API
  5. In the Credentials tab click onto "Add credentials"
  6. Then select "Service Account", click P12 and then "Create"
  7. A keyfile will be generated, just store it in a directory of your computer
    Then click "Close"
  8. You can find the service account email address in the "Credentials" window

  9. To be able to copy the email, click onto the email and another window will open. Copy the email address from there to the clipboard

  10. Now go to the Consent tab, select your email address, add a product name and click "Save"

2. Fusiontable

  1. Go to your Google drive, open your Fusiontable and click "File" - "Share"

  2. In the following window share the FusionTable with the ServiceAccount Email address (see Developers Console step 8), set the permissions to "can edit" and disable the checkbox "Notify people by email".

  3. Now, the Sharing settings will look like this

3. App Inventor

You can use the App Inventor test project from the Download section below to test the connection to your fusiontable.

  1. Download the example project from here and upload it into App Inventor.
  2. In the App Inventor Designer upload the keyfile (from step 7) into App Inventor

  3. In the Blocks Editor adjust the TABLE_ID, KeyFile and ServiceAccountEmail

  4. Connect the companion app and click button "Select" in the example app to get a list of all rows of your fusiontable.

  5. Ready

In case you get problems, see also Frequent Made Errors with Fusion Tables Fusiontables and how to fix them.


Download serviceaccount aia file
Download serviceaccount apk file to test the example using my test table
Back to top of page ...

Creative Commons License
This work by Pura Vida Apps is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
with attribution (name=Pura Vida Apps and link to the source site) required.

Home | Snippets | Tutorials | Extensions | Links | Search | Privacy Policy | Contact