Having problems getting Leaderboard working

I have followed the tutorial here - http://coronalabs.com/blog/2013/06/25/tutorial-introducing-google-play-game-services/

But can not get my score to go into the leaderboard. I have put native.showAlert everywhere in the app and all seem to show the right details, it’s going into the right functions, calling the correct listeners and am getting no errors.

I have the right id in build.settings and am using the correct category string.

When I launch my app I get logged into the Play Services etc…

I check the leaderboard on Google and it says no scores have been submitted.

Any ideas or where I can test if things are going wrong ?

Dave

Are you seeing any errors in your console log?  Make sure to do an “adb logcat” and don’t filter for Corona only messages since the errors could come from the Google Play app.

Rob

Here are some errors I see -

D/BaseGameActivity(25476): isGooglePlayServicesAvailable returned 0

D/BaseGameActivity(25476): beginUserInitiatedSignIn: starting new sign-in flow.

D/BaseGameActivity(25476): Connecting GamesClient.

E/GooglePlayServicesUtil(25476): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

EDIT: After submitting my score I have been going back to the Leaderboard in the Developer Console and checking to see if it has been updated, it hasn’t.

I have just wrote a bit of code in my app to bring back the data from the leaderboard instead using LoadScores and LoadPlayers and am in their. Can’t believe this, I have worked on this for 3 days thinking it wasn’t working and all along it might have been.

So for anyone else reading this, don’t rely on the Developer Console on Google, physically get the leaderboard on your code and check the contents.

EDIT 2: All seems fine now, apart from - http://forums.coronalabs.com/topic/48618-is-this-a-bug-or-how-it-works-gamenetworkrequestloadplayers/

Dave

Are you seeing any errors in your console log?  Make sure to do an “adb logcat” and don’t filter for Corona only messages since the errors could come from the Google Play app.

Rob

Here are some errors I see -

D/BaseGameActivity(25476): isGooglePlayServicesAvailable returned 0

D/BaseGameActivity(25476): beginUserInitiatedSignIn: starting new sign-in flow.

D/BaseGameActivity(25476): Connecting GamesClient.

E/GooglePlayServicesUtil(25476): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

EDIT: After submitting my score I have been going back to the Leaderboard in the Developer Console and checking to see if it has been updated, it hasn’t.

I have just wrote a bit of code in my app to bring back the data from the leaderboard instead using LoadScores and LoadPlayers and am in their. Can’t believe this, I have worked on this for 3 days thinking it wasn’t working and all along it might have been.

So for anyone else reading this, don’t rely on the Developer Console on Google, physically get the leaderboard on your code and check the contents.

EDIT 2: All seems fine now, apart from - http://forums.coronalabs.com/topic/48618-is-this-a-bug-or-how-it-works-gamenetworkrequestloadplayers/

Dave

Hi,

Apologies for bringing up this old thread but I’m experiencing a similar problem. 

I tried calling LoadScores and displaying the table using a simple native.showAlert in a for loop but nothing happens… 

The Developer Console scores and players are also not updated… 

Any ideas? Or is there just a delay in posting scores to gpgs? 

Jo

To be honest I don’t remember but I do remember messing for days and then it started working.

Also check my other thread linked above as you might be reading the wrong fields.

local function networkTeamListenerRequest( event ) if event.data then --native.showAlert( "Players loaded", event.type, {"OK"}) if event.type == "loadScores" then --event.data has your data --print (event.data[i].playerID) end end end local function loadScores() gameNetwork.request( "loadScores", { leaderboard = { category="GET THIS FROM GOOGLE DEVELOPER CONSOLE", playerScope="FriendsOnly", -- Global, FriendsOnly timeScope="AllTime", -- AllTime, Week, Today range={1,25}, playerCentered = false, }, listener=networkTeamListenerRequest }) end

Just pulled that out of my code, not sure if it’s complete or not to be honest and don’t forget that worked 1 year ago, so things may have changed.

Dave

Hi Dave,
Thanks for replying. I got it working yesterday. Turns out I the string I am passing as the leaderboard id have an extra /r character at the end. That was really silly.

Hi,

Apologies for bringing up this old thread but I’m experiencing a similar problem. 

I tried calling LoadScores and displaying the table using a simple native.showAlert in a for loop but nothing happens… 

The Developer Console scores and players are also not updated… 

Any ideas? Or is there just a delay in posting scores to gpgs? 

Jo

To be honest I don’t remember but I do remember messing for days and then it started working.

Also check my other thread linked above as you might be reading the wrong fields.

local function networkTeamListenerRequest( event ) if event.data then --native.showAlert( "Players loaded", event.type, {"OK"}) if event.type == "loadScores" then --event.data has your data --print (event.data[i].playerID) end end end local function loadScores() gameNetwork.request( "loadScores", { leaderboard = { category="GET THIS FROM GOOGLE DEVELOPER CONSOLE", playerScope="FriendsOnly", -- Global, FriendsOnly timeScope="AllTime", -- AllTime, Week, Today range={1,25}, playerCentered = false, }, listener=networkTeamListenerRequest }) end

Just pulled that out of my code, not sure if it’s complete or not to be honest and don’t forget that worked 1 year ago, so things may have changed.

Dave

Hi Dave,
Thanks for replying. I got it working yesterday. Turns out I the string I am passing as the leaderboard id have an extra /r character at the end. That was really silly.