GPGS leaderboard "There are no public high scores for this game"

Hello, there’s a GPGS problem in our android project:

The GPGS will login the current user, display the welcome banner, and we can open the leaderboard as well, but no scores there.
The game already published, have some downloads and players too.

I found that there already have a reply asked the same question in this blog, but no answer:
https://coronalabs.com/blog/2013/06/25/tutorial-introducing-google-play-game-services/#respond

Any one could help and post correct code of submit high score to GPGS leaderboard?

Thanks!

Can you post your code where you’re trying to submit the score?

Hi, here is my code:

[lua]

gameNetwork.request( “setHighScore”,{

    localPlayerScore = { category = “CgkI1pLdy7wHEAIQAA”, value = tonumber(highScoreValue) },

})

[/lua]

If you look back to that tutorial and find the code for setting a high score, you will see a “listener” function. You don’t have one. You should create a listener function to allow gameNetwork.request() the opportunity to return information back to you about the success of the call. There will be a table passed to that listener function with the results of the call that you should print out the values that were returned. An easy way to do that is:

local json = require( "json" ) local function handleSetLeaderboard( event )       print( json.prettify( event ) ) end

and see what the results are in the console log.

You should also look at your device’s console log ( adb logcat with no additional parameters) and see if you’re getting any errors from GPGS.

I found something strange in the console log, it says:

12246-12292/? E/GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

But my game could login to Google Play, and display the leaderboard page.

Ok, now i got this working…

I found some answers on stackoverflow.com, said “The Google Play services resources were not found…” is a bug, actually the service will still work, so we can ignore it. 

Then, the “gameNetworkLoginCallback” never get called in my code, so the value of gameNetworkReady was always false. It’s important, because when gameNetworkReady==false, my code will ignore other gameNetwork request call 

[lua]

local function gameNetworkLoginCallback( event )

    if not event.data.isError then

        print(“game network ready”)

        gameNetworkReady = true

    else

        print( json.prettify( event ) )

    end

end

gameNetwork.request( “login”, { userInitiated=true, listener=gameNetworkLoginCallback } )

[/lua]

Can you post your code where you’re trying to submit the score?

Hi, here is my code:

[lua]

gameNetwork.request( “setHighScore”,{

    localPlayerScore = { category = “CgkI1pLdy7wHEAIQAA”, value = tonumber(highScoreValue) },

})

[/lua]

If you look back to that tutorial and find the code for setting a high score, you will see a “listener” function. You don’t have one. You should create a listener function to allow gameNetwork.request() the opportunity to return information back to you about the success of the call. There will be a table passed to that listener function with the results of the call that you should print out the values that were returned. An easy way to do that is:

local json = require( "json" ) local function handleSetLeaderboard( event )       print( json.prettify( event ) ) end

and see what the results are in the console log.

You should also look at your device’s console log ( adb logcat with no additional parameters) and see if you’re getting any errors from GPGS.

I found something strange in the console log, it says:

12246-12292/? E/GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

But my game could login to Google Play, and display the leaderboard page.

Ok, now i got this working…

I found some answers on stackoverflow.com, said “The Google Play services resources were not found…” is a bug, actually the service will still work, so we can ignore it. 

Then, the “gameNetworkLoginCallback” never get called in my code, so the value of gameNetworkReady was always false. It’s important, because when gameNetworkReady==false, my code will ignore other gameNetwork request call 

[lua]

local function gameNetworkLoginCallback( event )

    if not event.data.isError then

        print(“game network ready”)

        gameNetworkReady = true

    else

        print( json.prettify( event ) )

    end

end

gameNetwork.request( “login”, { userInitiated=true, listener=gameNetworkLoginCallback } )

[/lua]