gpgs.* — Google Play Games Services

Type Library
Revision Release 2024.3703
Keywords Google Play Games Services, game network, gpgs
Platforms Android

Overview

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

This documentation outlines the legacy Google Play Games Services plugin, primarily intended for Android games still using multiplayer. For new Android games, you should use Google Play Games Services v2 plugin.

Important
  • To use this plugin, you must implement Google app licensing as outlined here and sign the .apk with a private key as outlined here.

  • 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" )

Functions

These core functions manage connection to Google’s servers, authentication, and other tasks.

gpgs.init()

gpgs.isConnected()

gpgs.login()

gpgs.logout()

gpgs.getAppId()

gpgs.getAccountName()

gpgs.getServerAuthCode()

gpgs.getSdkVersion()

gpgs.setPopupPosition()

gpgs.loadGame()

gpgs.loadImage()

gpgs.showSettings()

gpgs.enableDebug()

Nodes

Specific functionality aspects of this plugin are divided into nodes for better organization:

gpgs.achievements

gpgs.leaderboards

gpgs.players

gpgs.events

gpgs.quests

gpgs.requests

gpgs.snapshots

gpgs.videos

Events

init

login

loadGame

loadImage

showSettings

getAccountName

getServerAuthCode

Types

Game

Image

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"] =
        {
            publisherId = "com.coronalabs",
            supportedPlatforms = { android=true }
        },
    },
}

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",
    },
}