build.settings (relevant parts)
["plugin.gpgs"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } } android = { googlePlayGamesAppId = "myAppId", usesPermissions = { "android.permission.INTERNET", "com.android.vending.CHECK\_LICENSE" }, },
config.lua
license = { google = { -- The "key" value is obtained from Google key = "Key from Play Developer Console", -- The "policy" key is optional; its value can be either "serverManaged" (default) or "strict" -- A value of "serverManaged" will query the Google server and cache the results (this is similar to Google's "ServerManagedPolicy") -- A value of "strict" will not cache the results, so when there's a network failure, the licensing will fail (this is similar to Google's "StrictPolicy") policy = "serverManaged" }, },
main.lua
local function gpgsInitListener(event) print("GPGS init: " .. event.name) if event.isError then -- Failed to verify app from the Google Play store; print a message print("GPGS init error message: " .. event.errorMessage) print("GPGS init error code: " .. event.errorCode) else print("GPGS init succeeded") end end gpgs.init(gpgsInitListener)
login code
local function loginListener(event) if event.isError then -- Failed to login to Google print("GPGS login error message: " .. event.errorMessage) print("GPGS login error code: " .. event.errorCode) else print("Successfully logged in to Google") showLoginButton(false) end end gpgs.login({userInitiated = true, listener = loginListener})