The Cocoon Game Center Social plugin is a Cordova plugin aimed at providing easy integration with the iOS Game Center Social API that include things like leaderboards and achievements.


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

Screen Shot 2016-01-18 at 17.15.47

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

Screen Shot 2016-01-18 at 17.16.32



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 Social plugin in your application.



Submit achievement

Show achievements

Submit score

Show leaderboard

Other API methods

Please see the full API below and the example for more Game Center Social 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

  • Create the leaderboards and achievements.

Screen Shot 2016-01-18 at 17.44.53

  • 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.