Google Play Games Services

Type Library
Revision Release 2024.3703
Keywords google, google play games services, achievements, leaderboards, multiplayer
Platforms Android
Sample https://github.com/coronalabs/com.coronalabs-plugin.gpgs.v2

Overview

The Google Play Games Services plugin enables access to Google Play Games Services for game networking, including achievements, leaderboards, quests, videos, and more.

Important
  • GPGSv2 no longer supports multiplayer and Google has stopped supporting multiplayer as of March 31, 2020. See legacy plugin for access to multiplayer apis.

  • Formerly, this plugin was also compatible with iOS, but Google no longer supports integration with iOS. If you previously implemented this service on iOS, you should migrate that implementation to another service.

If you encounter Google Play Games Services login issues/errors after implementing this plugin, ensure that you have enabled both Drive API and Google Play Developer API within the Google Play Developer Console.

Syntax

local gpgs = require( "plugin.gpgs.v2" )

Project Settings

To use this plugin, add an entry into the plugins table of build.settings. When added, the build server will integrate the plugin during the build phase.

settings = {
    plugins = {
        ["plugin.gpgs.v2"] = {
            publisherId = "com.coronalabs",
        }
    }
}

Additionally, you must specify the Google Play Games App ID in the android table of build.settings as the googlePlayGamesAppId key:

settings = {

    android =
    {
        googlePlayGamesAppId = "YOUR_APPLICATION_ID",
    },
}

Nodes

The plugin is divided into API nodes for better organization.

gpgs2.achievements

gpgs2.leaderboards

gpgs2.players

gpgs2.events

gpgs2.snapshots

gpgs2.videos

gpgs.*

Overview

This is the base API node for the plugin. It manages connection to the Google’s servers, authentication and general SDK tasks.

Functions

gpgs2.enableDebug()

gpgs2.isConnected()

gpgs2.isAuthenticated()

gpgs2.login(params)

gpgs2.logout()

gpgs2.getAccountName(listener)

gpgs2.getServerAuthCode(params)

gpgs2.setPopupPosition(position)

gpgs2.loadGame(listener)

gpgs2.loadImage(params)

gpgs2.showSettings(listener)

Events

login

getAccountName

getServerAuthCode

loadGame

loadImage

Types

Game