After you've written your Hangout app, it's time to actually run it inside of a Hangout. This document walks you through that process.
Publish the app XML
If you haven't done so already, you must publish your Gadget XML file to a publicly accessible URL. Any stable URL will do, such as a repository on Google Project Hosting or an application on Google App Engine.
Create a Google Developers Console project for your app
- Go to the Google Developers Console .
- From the project drop-down, select an existing project , or create a new one by selecting Create a new project.
Enable the Google+ Hangouts API service:
- In the list of Google APIs, search for the Google+ Hangouts API service.
- Select Google+ Hangouts API from the results list.
- Press the Enable API button. Wait for the API to be enabled.
In the sidebar under "API Manager", select Credentials, then select
the OAuth consent screen tab.
- Choose an Email Address, specify a Product Name, and press Save.
Configure the API:
- In the left sidebar, select API Manager and then select the Enabled APIs tab.
- To the right of the Google+ Hangouts API service name, press the gear icon .
- In the Application URL field, enter the URL where you publish your Hangout gadget XML file.
- Fill out other information requested on that page.
- Press Save.
Running your app privately
Before your app is marked as public in the Google Developers Console, any member of your project team may run it privately in any Hangout. Your team members are managed in the Google Developers Console, under project Permissions. To access, go to Google Developers Console Permissions, then choose your Hangouts project.
To run the app privately:
- Open a Hangout.
- Move the mouse pointer to the left edge of the Hangout to reveal the menu, choose the three dots (...), then Add apps. The app picker appears.
- Choose the Developer tab.
- Select the app that you want to run privately from the list of apps you have registered in the Google Developers Console.
The app loads and appears in the active apps list on the left with a special icon ( ) that indicates that it is running as a private app. Only project members of your Google Developers Console team will be able to see the app.
Private apps display a special toolbar at the top, which is labeled Manage Developed Apps. The toolbar contains four buttons, which are useful for debugging your app during development:
- Share app
- See sharing your private app.
- Load app
- Reopens the app picker, which allows you to open another public or private app.
- Reload app
- Loads and parses the latest version of the Hangout XML file, while preserving the application state. Use this button to pick up new code changes.
- Reset app state
- Re-initializes the application state for the currently loaded Hangout app. This button clears the keys that are stored in the shared state. After resetting the app state, the app behaves as if you started it for the first time.
Permissions and authorization
An app with an OAuth 2.0 client ID will ask participants for permission to run the first time they try to use the app. Once a participant has agreed to these permissions, they won't be asked to agree to it again. A participant can revoke permission to the app by going to the Google Dashboard, selecting "Websites authorized to access the account", searching for the name of the app, and choosing Revoke Access.
To enable the authorization dialog box in development mode, you must create an OAuth 2.0 client ID. All apps available to the public must have an OAuth2 client ID.
Passing data to the app
You can pass your app an initial set of data by adding the query
gd=somevalue. Your app can read this
query parameter's value using the following code:
var appData = gadgets.views.getParams()['appData'];
In order to read data passed to your app, make sure you have specifed the
"views" feature in the
ModulePrefs section of your
<ModulePrefs> <Require feature="views"/> </ModulePrefs>