The Cocoon Google Play Games Multiplayer plugin is a Cordova plugin aimed at providing easy integration with  the Android Google Play Games Multiplayer  API.


To add the Google Play Games Multiplayer plugin to your project first go to your project configuration and once there go to the Setting  section and click on the “Plugins” tab. You should see something like this:

New Cocoon

If you click on the “Cocoon” category you will see al the Cocoon available plugins.  Over the plugins list you will see a dropdown menu set to “All” by default. Click on the menu to see the available Cocoon plugins categories, you should see a list of plugins with at least the following groups:

Screen Shot 2016-01-05 at 16.40.33

Select the “Google Play Games Multiplayer API” plugin. Then the Google Play Games related plugins should be filtered in the plugins list.

Screen Shot 2016-01-18 at 17.49.30


Now click on install and your project will include the Google Play Games Multiplayer plugin in the next compilation.

Screen Shot 2016-01-19 at 16.02.52



Getting the Application ID

You can find the Application ID in the Google Play Developer Console, in your apps application settings:


Screen Shot 2016-01-14 at 15.47.12

Setting up the APP ID

Using the Cocoon Plugins interface

You can setup the Application ID using the Cocoon cloud plugins interface. After installing the Google Play Games Multiplayer plugin you will see an “Add Parameter” button under the plugin details:

Screen Shot 2016-01-14 at 15.49.57

Click on that button and you will see two fields for adding a name and a value. You need to add the following parameters:

  • APP_ID: The Google Play Game Services Application ID

Screen Shot 2016-01-14 at 15.52.16

Do the same for the Google Play Games Social plugin.


Cordova needs to be specifically loaded in your index.html so it can start the Cordova framework and load the plugins that you have installed in your project. So first thing is to add the “cordova.js” script tag to your index.html.

That’s the only code script you need to include in your index.html for the plugin to be ready to be used. Cordova will do the rest.

Important: Remember to wait for the “deviceready” event before using the plugin as that is the moment when the plugin will be fully initialized.


Let’s see some code snippets showing how to use the Cocoon Google Play Games Multiplayer plugin in your application. This plugin is dependent on the Google Play Games Social plugin so some code like the login/logout and status change must be handled using the Google Play Games Social API. Take a look at it’s guide or the full example below to see how to manage the social code.


Listen for invitations

First thing to do is to listen for invitation events as an invitation may happen when the application is closed and the listener should be placed as soon as possible when the application is launched.


This code is part of theGoogle Play Games Social API but it’s required by the multiplayer plugin to work as you need to be logged in before starting a multiplayer match.

Starting a match showing the Google Games view

Other API methods

Please see the full API below and the example for more Google Play Games Multiplayer API methods.






Testing the Google Play Games integration is not easy, the process requires configurations in the Google Developer Console:

  • Setup the app and set it ready to be published
  • Configure a Game Services application and publish it.

Screen Shot 2016-01-14 at 16.39.06

  • Add the testers that will be able to test the Game Services.

Screen Shot 2016-01-14 at 16.50.55

  • Make sure that the application has the Real-time Multiplayer option enabled. Go to Game Services -> Linked Apps. Select your app and make sure that the “Real-time multiplayer” switch is ON.

Screen Shot 2016-01-14 at 16.40.11

  • Setup the Alpha testing in your project in the Developer Console. You can setup the alpha testing mode your prefer but remember to create a list with the email addresses of the alpha testers. Ideally these emails will be the same as in the Games Services testing list.

Screen Shot 2016-01-14 at 16.44.05

  • Install the Google Play Games Multiplayer plugin in your Cocoon project.
  • Compile a signed Developer App. It’s important that it’s signed as it’s a requirement for being able to test it later.
  • Upload your APK  to the Alpha and publish it. Don’t worry, the application is not visible to the general public, it’s only accessible by the alpha tester that have the link. You will se the link after the APK is processed. Once the link is available the alpha testers can use it to install the APK and start testing the APK.
  • Launch you app from the Developer App using a zip or a url.

All this process is tedious so we recommend to use the Developer App so you don’t have to upload a new APK each time you modify your code.