Google leaderboard Help

Hi,

I’ve tried following different ways on the forum to get the leaderboard to show but I haven’t succeeded.

When I press the leaderboard button in my game, it loads the google game service but then goes back to the game. There are no errors that show in the console. This is the code I have:

build.settings

settings = { plugins = { ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, ["CoronaProvider.native.popup.social"] = { publisherId = "com.coronalabs" }, ["plugin.google.iap.v3"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, ["CoronaProvider.gameNetwork.google"] = { publisherId = "com.coronalabs", supportedPlatforms = { android = true }, }, ["plugin.chartboost"] = { publisherId = "com.swipeware", }, ["plugin.facebook.v4"] = { publisherId = "com.coronalabs" }, ["plugin.applovin"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true, appletvos=true } }, ["plugin.revmob"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, }, orientation = { default = "portrait", supported = { "portrait" } }, android = { facebookAppId = "XXXXXXXXXXXXXXX", -- Replace XXXXXXXXXXXXXXX with your Facebook App ID googlePlayGamesAppId = "558844732111", --insert your app id number for google game services usesPermissions = { "com.android.vending.BILLING", --remove this line if you don't use iAP "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.WRITE\_EXTERNAL\_STORAGE" }, } }

main.lua

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 )

menuscene.lua (the button is here)

 local leaderButton = ragdogLib.newSimpleButton(group, "IMG/leader.png", 67, 67); leaderButton.x, leaderButton.y = centerX-90, centerY+120; function leaderButton:touchBegan() self:setFillColor(.7, .7, .7); self.xScale, self.yScale = .9, .9; audio.play(\_G.buttonSFX, {channel = audio.findFreeChannel()}); end function leaderButton:touchEnded() self:setFillColor(1, 1, 1); self.xScale, self.yScale = 1, 1; --gpgs = require( "plugin.gpgs" ); --gpgs.init(); --gpgs.login( "userInitiated"=true ); --gpgs.leaderboards.loadScores("leaderboardId"="CgkIz8X37aEQEAIQAA", "reload"=true); local function showLeaderboards( event ) if ( system.getInfo("platformName") == "Android" ) then gameNetwork.show( "leaderboards" ) else gameNetwork.show( "leaderboards", { leaderboard = {timeScope="AllTime"} } ) end return true end end

That all looks about right. Are you sure you’ve every successfully submitted scores? Are you sure you have everything setup in your Google Play Developer’s console correctly?

Rob

Thanks for response. Everything in Google Play console looks right.

I haven’t submitted score yet. I thought the leaderboard has to work for me to be able to do that.

Is there another way to submit score to get it to work?

That all looks about right. Are you sure you’ve every successfully submitted scores? Are you sure you have everything setup in your Google Play Developer’s console correctly?

Rob

Thanks for response. Everything in Google Play console looks right.

I haven’t submitted score yet. I thought the leaderboard has to work for me to be able to do that.

Is there another way to submit score to get it to work?