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 .
or create a new one by clicking Create Project:
- In the Project name field, type in a name for your project.
- In the Project ID field, optionally type in a project ID for your project or use the one that the console has created for you. This ID must be unique world-wide.
- Click the Create button and wait for the project to be created.
- Click on the new project name in the list to start editing the project.
- In the left sidebar, select the APIs item below "APIs & auth". A list of Google web services appears.
- Find the Google+ Hangouts API service and set its status to ON—notice that this action moves the service to the top of the list. You can turn off the Google Cloud services if you don't need them. Enable any other APIs that your app requires.
In the sidebar under "APIs & auth", select Consent screen.
- Choose an Email Address and specify a Product Name.
- To the right of the Google+ Hangouts API service name, click on 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. Click 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 listed at Google Developers Console > choose your Hangout project > choose Permissions.
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.
- Click 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, clicking "Websites authorized to access the account", searching for the name of the app, and clicking 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>