cordova-plugin-play-games-services
Advanced tools
Comparing version
{ | ||
"name": "cordova-plugin-play-games-services", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Google Play Games Services Cordova Plugin for Android", | ||
@@ -5,0 +5,0 @@ "cordova": { |
@@ -1,9 +0,8 @@ | ||
cordova-plugin-play-games-services | ||
================================== | ||
# Cordova Plugin For Play Games Services | ||
Cordova Plugin For Google Play Games Services (Fork of [ptgamr/cordova-google-play-game](https://github.com/ptgamr/cordova-google-play-game)) | ||
Cordova Plugin For Google Play Games Services (Fork of [ptgamr/cordova-google-play-game](https://github.com/ptgamr/cordova-plugin-play-games-services)) | ||
Modified to include the new Google Play Services with com.google.android.gms:play-services and avoid some compiling errors. (Available also through npm, new Plugin Registry Format) | ||
Modified to include the new Google Play Services (GoogleApiAvailability) and new methods for Leaderboards and Achievements. | ||
### Before you start | ||
**Before you start:** | ||
@@ -16,3 +15,3 @@ Understand about **Leaderboard** and **Achievement**. Setting up your game in Google Play Developer Console https://developers.google.com/games/services/android/quickstart | ||
``` | ||
```bash | ||
cordova plugin add cordova-plugin-play-games-services --variable APP_ID=you_app_id_here | ||
@@ -23,3 +22,3 @@ ``` | ||
``` | ||
```bash | ||
cordova plugin add https://github.com/artberri/cordova-plugin-play-games-services.git --variable APP_ID=you_app_id_here | ||
@@ -35,3 +34,3 @@ ``` | ||
``` | ||
```js | ||
window.plugins.playGamesServices.auth(); | ||
@@ -43,3 +42,3 @@ ``` | ||
``` | ||
```js | ||
window.plugins.playGamesServices.signout(); | ||
@@ -51,3 +50,3 @@ ``` | ||
``` | ||
```js | ||
window.plugins.playGamesServices.isSignedIn(function (result) { | ||
@@ -66,3 +65,3 @@ // ‘result’ is a JSON object with a single boolean property of ‘isSignedIn’ | ||
``` | ||
```js | ||
window.plugins.playGamesServices.showPlayer(function (playerData) { | ||
@@ -74,3 +73,2 @@ ... | ||
### Leaderboards | ||
@@ -82,3 +80,3 @@ | ||
``` | ||
```js | ||
var data = { | ||
@@ -91,2 +89,16 @@ score: 10, | ||
#### Sumit Score Now | ||
Ensure you have had a successful callback from `window.plugins.playGamesServices.auth()` first before attempting to submit a score. You should also have set up your leaderboard(s) in Google Play Game Console and use the leaderboard identifier assigned there as the `leaderboardId`. | ||
This method submit the score immediately. | ||
```js | ||
var data = { | ||
score: 10, | ||
leaderboardId: "board1" | ||
}; | ||
window.plugins.playGamesServices.submitScoreNow(data); | ||
``` | ||
#### Show all leaderboards | ||
@@ -96,3 +108,3 @@ | ||
``` | ||
```js | ||
window.plugins.playGamesServices.showAllLeaderboards(); | ||
@@ -105,3 +117,3 @@ ``` | ||
``` | ||
```js | ||
var data = { | ||
@@ -118,3 +130,3 @@ leaderboardId: "board1" | ||
``` | ||
```js | ||
var data = { | ||
@@ -131,3 +143,3 @@ achievementId: "achievementId1" | ||
``` | ||
```js | ||
var data = { | ||
@@ -145,3 +157,3 @@ achievementId: "achievementId1", | ||
``` | ||
```js | ||
window.plugins.playGamesServices.showAchievements(); | ||
@@ -158,3 +170,3 @@ ``` | ||
``` | ||
```js | ||
var successfullyLoggedIn = function () { ... }; | ||
@@ -161,0 +173,0 @@ var failedToLogin = function () { ... }; |
@@ -9,4 +9,4 @@ var exec = require('cordova/exec'); | ||
var actions = ['auth', 'signOut', 'isSignedIn', | ||
'submitScore', 'showAllLeaderboards', 'showLeaderboard', | ||
'unlockAchievement', 'incrementAchievement', 'showAchievements', 'showPlayer']; | ||
'submitScore', 'submitScoreNow', 'getPlayerScore', 'showAllLeaderboards', 'showLeaderboard', | ||
'unlockAchievement', 'unlockAchievementNow', 'incrementAchievement', 'incrementAchievementNow', 'showAchievements', 'showPlayer']; | ||
@@ -35,5 +35,5 @@ actions.forEach(function (action) { | ||
exec(success, failure, PLAY_GAMES_SERVICES, action, [data]); | ||
} | ||
}; | ||
}); | ||
module.exports = new PlayGamesServices(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
96853
14.26%1853
9.91%175
7.36%