The Cocoon Game Center Multiplayer plugin is a Cordova plugin aimed at providing easy integration with  the  Game Center API.


To add the Game Center 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 “Game Center Multiplayer API” plugin. Then the Game Center related plugins should be filtered in the plugins list.

Screen Shot 2016-01-14 at 15.41.35

Now click on install and your project will include the Game Center Multiplayer plugin in the next compilation.

Screen Shot 2016-01-18 at 17.51.45

Important: This plugin is dependent on the Game Center Social plugin so after installing it the Game Center Social plugin will be also installed.


This plugins doesn’t need any parameters.


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 Game Center Multiplayer plugin in your application. This plugin is dependent on the Game Center Social plugin so some code like the login/logout and status change must be handled using the Game Center 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 theGame Center 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 Game Center view

Other API methods

Please see the full API below and the example for more Game Center Multiplayer API methods.






Testing the Game Center integration requires configurations in iTunes Connect and the Apple Developer Center. We also recommend that you read the Game Center guide before start setting up the plugin.

  • Enable Game Center in your App Id in the Apple Developer Center.

Screen Shot 2016-01-18 at 17.31.51

Screen Shot 2016-01-18 at 17.35.11

Screen Shot 2016-01-18 at 17.35.24

  • Make sure that when testing in the device you are logged out from Game Center in your phone. You need to open your app while logged out from Game Center and log in with a sandbox account.
  • Install the Game Center Social 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.
  • Launch your 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.