Hello everyone,
I am trying to have a leaderboard in my game using the google play game service.
I am following this tutorial: https://coronalabs.com/blog/2013/06/25/tutorial-introducing-google-play-game-services/
to implement the plugin.
However it seems that I cannot reach successful connection to the server.
I have added print statement to my code to see where it is failing;
here is my code below:
my build setting:
android = { googlePlayGamesAppId = "MyAppId" -- I ve added my appId here } plugins = { ["CoronaProvider.gameNetwork.google"] = { publisherId = "com.coronalabs" } }
and I have a button on my main screen that executes the following code:
local function onButton() print('I want the LD here') local gameNetwork = require( "gameNetwork" ) local playerName local function loadLocalPlayerCallback( event ) playerName = event.data.alias print("Step 4") --saveSettings() --save player data locally using your own "saveSettings()" function end local function gameNetworkLoginCallback( event ) gameNetwork.request( "loadLocalPlayer", { listener=loadLocalPlayerCallback } ) print("Step 3") return true end local function gpgsInitCallback( event ) gameNetwork.request( "login", { userInitiated=true, listener=gameNetworkLoginCallback } ) print("Step 2") end local function gameNetworkSetup() if ( system.getInfo("platformName") == "Android" ) then gameNetwork.init( "google", gpgsInitCallback ) print("Step 1") else gameNetwork.init( "gamecenter", gameNetworkLoginCallback ) end end ------HANDLE SYSTEM EVENTS------ gameNetworkSetup() --login to the network here end
So when I run adb logcat Corona:v *:s and click on the button I reach;
Step 1, 2 and 3 but NOT step 4.
It is said in the tutorial:
“Once the proper service is initiated, we use gameNetwork.request() again to log in the player locally. Assuming this is successful, the loadLocalPlayerCallback() function is called.”
I do not think I reach the loadLocalPlayerCallback() function here, am I right?
Also could someone explain me why we need a saveSetting() function here?
Thank you for your help
JJ

