Last Updated: February 25, 2016
·
2.013K
· leecrossley

Game Center with PhoneGap in 4 Steps

I've made it incredibly easy to use the iOS Game Center in a PhoneGap / Cordova app:

1. Install the plugin

$ cordova plugin add https://github.com/leecrossley/cordova-plugin-game-center.git

2. Authenticate the user

gamecenter.auth(onSuccess, onError);

3. Submit a score

gamecenter.submitScore(onSuccess, onError, { 
    score: 100, 
    leaderboardId: "YOUR_ID"
});

4. Show the leaderboard

gamecenter.showLeaderboard(onSuccess, onError, { 
    period: "today",
    leaderboardId: "YOUR_ID"
});

Plugin is open source and on GitHub. More details available on the full blog post.