Newtonian Particle Motion
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


1.0.0 • Public • Published


npm version build status

React Native Google Play Game Services bindings for Android (Google Play Game Services for iOS no longer exists).

Currently implements achievements but events, leaderboards etc will be added on request.



  • SDK 23+


This package was built for React Native 0.40 or greater! If you're still on an earlier version you're welcome to check it out and patch the package.json file but there's not going to be anyone to support you.

Before installing

It is highly recommended that prior to installing this library that you make yourself familiar with Google Play Game Services and

This document does not cover those steps but you will need to follow them prior to getting an app up and running.

There are two key steps in the process:

  • Add a new game in the Google Play Console and note down your app id
  • Link your app - if you don't follow this step correctly this library will silently fail

Also you will need to create some achievements and note down their ids for using the library.


Currently there are a number of steps that cannot be automated.

Run npm install --save react-native-google-play-game-services to add the package to your app's dependencies.

react-native cli

Run react-native link react-native-google-play-game-services so your project is linked against the Android library

Manual steps

In your android/build.gradle add:

allprojects {
  repositories {
+   maven { url '' }

In your android/app/build.gradle (note: this is not the same file as above) add:

dependencies {
+  compile ""
+  compile ""

In your 'android/app/src/main/AndroidManifest.xml':

+      <meta-data android:name="" android:value="@string/app_id" />
+      <meta-data android:name=""

In your 'android/app/src/main/res/values/strings.xml' (create it if it doesn't exist) you need to add your app id:

``diff ... gpsgexample {your app id from google play console - 10-12 digit number}

Lastly ensure that you have Google Play Services installed on the target device.

For Genymotion you can follow these instructions. For a physical device you need to search on Google for 'Google Play Services'. There will be a link that takes you to the Play Store and from there you will see a button to update it (do not search within the Play Store). ndroid Pay deployment and testing.


The API closely follows the Google Play Game Services Android API so if you're not following the below the official documentation should help.

Basically you need to sign in - you can do this silently or through the official UI from Google but you do need to call one of the two sigin in functions before any others will work so calling when your main UI component mounts is probably good practise. You may find if your app has been suspended it will also need to be called. How to deal with this I will leave as an exercise for the reader.

You can then assign achievements and show the achievement table. Simple.

import RNGooglePlayGameServices from 'react-native-google-play-game-services';
// SIGN in prior to doing anything - silent sign in works for those who are already logged into google play gaming services
    .then((msg) => {
    .catch((msg) => {
        //silent sign in didn't work so show the dialog instead
        //note probably should catch errors here
//unlock an achievement - note the id supplied is obtained by creating a new achievement in the play console
        .then((msg) => { console.log("unlocked achievement -  ",msg)})
        .catch((msg) => { console.log("not signed in - ",msg)});
//increment an achievement - note the id supplied is obtained by creating a new achievement in the play console
        .then((msg) => { console.log("incremented achievement -  ",msg)})
        .catch((msg) => { console.log("not signed in - ",msg)});
//show player the achievements list 
//note: should also catch errors here
// Am I signed in?
        .then((msg) => { console.log("signed in - ",msg)})
        .catch((msg) => { console.log("not signed in - ",msg)});
//sign out 
        .then((msg) => { console.log("signed out - ",msg)})
        .catch((msg) => { console.log("not signed out - ",msg)});


It won't compile

Check you followed all the steps in the install guide

It's not doing anything or failing silently

Use the command adb logcat and grep for OAuth - if you're getting OAuth failures it's because you haven't linked your app properly. You need to follow the getting started instructions. There will be two apps - one is your debug and one is your release. It's important that you have two because the production OAuth doesn't work with debug and vice versa.


npm i react-native-google-play-game-services

Downloadsweekly downloads









last publish


  • avatar
Report a vulnerability