Triyng Login into Game Center full code

i have problem in connection with google play,

this app is signed key

GPlay get for first time my credentials of google

i try connect with connect button but fail

build.settings:

-- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = { orientation = { default = "portrait", supported = { "portrait", } }, android = { googlePlayGamesAppId = "HIDDEN", -- Your Google Play Games App Id }, plugins = { -- key is the name passed to Lua's 'require()' ["CoronaProvider.gameNetwork.google"] = { -- required publisherId = "com.coronalabs", supportedPlatforms = { android = true } }, }, -- Android permissions androidPermissions = { "android.permission.INTERNET", "android.permission.VIBRATE", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.READ\_PHONE\_STATE", }, }

main.lua:

local \_W = display.contentWidth local \_H = display.contentHeight local centerX = display.contentCenterX local centerY = display.contentCenterY display.setDefault( "background", 1, 1, 1 ) local widget = require( "widget" ) local gameNetwork = require( "gameNetwork" ) local playerName local bd = require ("sqlite3") local path = system.pathForFile( "dataG.db", system.DocumentsDirectory ) local db = sqlite3.open( path ) local tablesetup = [[CREATE TABLE IF NOT EXISTS record (id INTEGER PRIMARY KEY autoincrement, data, alias);]] db:exec( tablesetup ) local function saveSettings() for a in db:urows('SELECT data FROM record WHERE id=1') do contents = a end if (contents==nil) then local insertQuery = [[INSERT INTO record VALUES (NULL, ']]..data..[[',']]..alias..[[');]] db:exec( insertQuery ) else for b in db:urows('SELECT data FROM record WHERE id=1') do data = b end for c in db:urows('SELECT alias FROM record WHERE id=1') do alias = c end end return data, alias end local function loadLocalPlayerCallback( event ) playerName = event.data.alias saveSettings(data, alias) --save player data locally using your own "saveSettings()" function end local function gameNetworkLoginCallback( event ) gameNetwork.request( "loadLocalPlayer", { listener=loadLocalPlayerCallback } ) return true end local function gpgsInitCallback( event ) gameNetwork.request( "login", { userInitiated=true, listener=gameNetworkLoginCallback } ) end local function gameNetworkSetup() if ( system.getInfo("platformName") == "Android" ) then gameNetwork.init( "google", gpgsInitCallback ) else gameNetwork.init( "gamecenter", gameNetworkLoginCallback ) end end ------HANDLE SYSTEM EVENTS------ local function systemEvents( event ) print("systemEvent " .. event.type) if ( event.type == "applicationSuspend" ) then print( "suspending..........................." ) elseif ( event.type == "applicationResume" ) then print( "resuming............................." ) elseif ( event.type == "applicationExit" ) then print( "exiting.............................." ) elseif ( event.type == "applicationStart" ) then gameNetworkSetup() --login to the network here end return true end Runtime:addEventListener( "system", systemEvents ) local function showLeaderboards( event ) if ( system.getInfo("platformName") == "Android" ) then gameNetwork.show( "leaderboards" ) else gameNetwork.show( "leaderboards", { leaderboard = {timeScope="AllTime"} } ) end return true end --for GameCenter, default to the leaderboard name from iTunes Connect local myCategory = "com.yourname.yourgame.highscores" if ( system.getInfo( "platformName" ) == "Android" ) then --for GPGS, reset "myCategory" to the string provided from the leaderboard setup in Google myCategory = "CgkI7NnYmOoPEAIQAQ" end local function showAchievements( event ) gameNetwork.show( "achievements" ) return true end --for GameCenter, default to the achievement name from iTunes Connect local myAchievement = "com.yourname.yourapp.achivementname" if ( system.getInfo("platformName") == "Android" ) then --for GPGS, reset "myAchievement" to the string provided from the achievement setup in Google myAchievement = "CgkIsqa23agVEAIQAg" end gameNetwork.request("unlockAchievement", { achievement = { identifier = myAchievement -- The id of the achievement to unlock for the current user ---- logro 1, repetir cuatro veces mas --- } }) local button4Press = function ( event ) -- menu gameNetwork.request("setHighScore", { localPlayerScore = { category = myCategory, -- Id of the leaderboard to submit the score into value = 500 -- The score to submit --- Score a Agregar ---- } }) end local button4 = widget.newButton { textOnly = true, label = " Send Score", labelColor = { default={ 0, 0, 0 }, over={ 1, 0, 0} }, emboss = true, onPress = button4Press, onRelease = button4Release, } button4.x = centerX; button4.y = centerY local button5Press = function( event ) showLeaderboards( event ) end local button5 = widget.newButton { textOnly = true, label = "Leadearboards", labelColor = { default={ 0, 0, 0 }, over={ 1, 0, 0} }, emboss = true, onPress = button5Press, } button5.x = centerX; button5.y = centerY-50 local button6Press = function( event ) showLeaderboards( event ) end local button6 = widget.newButton { textOnly = true, label = "Achievement", labelColor = { default={ 0, 0, 0 }, over={ 1, 0, 0} }, emboss = true, onPress = button6Press, } button6.x = centerX; button6.y = centerY+50 local button7Press = function( event ) if gameNetwork.request("isConnected") then display.newImage("yes.png", centerX+70, centerY) gameNetwork.show("leaderboards") else display.newImage("no.png", centerX-70, centerY) end end local button7 = widget.newButton { textOnly = true, label = "is connect?", labelColor = { default={ 0, 0, 0 }, over={ 1, 0, 0} }, emboss = true, onPress = button7Press, } button7.x = centerX; button7.y = centerY-100 local button8Press = function( event ) gpgsInitCallback( ) end local button8 = widget.newButton { textOnly = true, label = "CONNECT", labelColor = { default={ 0, 0, 0 }, over={ 1, 0, 0} }, emboss = true, onPress = button8Press, } button8.x = centerX; button8.y = centerY+100 local button9Press = function( event ) gameNetwork.request("logout") end local button9 = widget.newButton { textOnly = true, label = "LOGOUT", labelColor = { default={ 0, 0, 0 }, over={ 1, 0, 0} }, emboss = true, onPress = button9Press, } button9.x = centerX; button9.y = centerY+150

Is all code…

i need help, i read various post, try with various samples of corona labs but not working.

Mine work fines and I do the following on my main.lua

 local gameNetwork = require( "gameNetwork" )     gameNetwork.init( "google" ) gameNetwork.request("login", { listener = function() end, userInitiated = false })  

ty renato, now connect but not show Leadearboards and not send score and achievements…

I already published my app and game services…

The package name is different of the original package, i can publish score and achievements…

Thank you…

Mine work fines and I do the following on my main.lua

 local gameNetwork = require( "gameNetwork" )     gameNetwork.init( "google" ) gameNetwork.request("login", { listener = function() end, userInitiated = false })  

ty renato, now connect but not show Leadearboards and not send score and achievements…

I already published my app and game services…

The package name is different of the original package, i can publish score and achievements…

Thank you…