As I want to update to GPGS V2, I need to check its functionality.
The following was already the case with GPGS V1:
When I want to test the game, the dialogue “Connecting To…” pops up, turns to a green Google Play box, a loading circle appears and disappears abruptly. I think it wants to log in my user, but cancels for some reason. When I call gpgs.leaderboards.show("") then, nothing happens.
When I download the same game from the Play Store, it logs in fine: The dialogue that comes from the top and says “Welcome back, xyz-user” shows, and the leaderboard is able to open.
The loginCallbackGpgs() gets called, the loadLocalPlayerCallback() doesn’t get called.
This is the code that I use (V2):
local function loadLocalPlayerCallback(e) --- this does not get called end local function loginCallbackGpgs(e) --- this gets called successfully gpgs.players.load({listener = loadLocalPlayerCallback}) end gpgs.login({userInitiated = true, listener = loginCallbackGpgs}) --- then some time later: function showLeaderboards() gpgs.leaderboards.show("xyz") end
Can you add this line to the “loginCallbackGpgs” function?
print( json.prettify(event) )
This way you can see if you have actually been authenticated. “loginCallbackGpgs” will be called even if there is an error. So you need to check inside this function if you’re connected or what.
gpgs = require( "plugin.gpgs.v2" ) function uploadHighScore() print ("\_uploadHighScore", finishedSoManyLevels) if gpgs.isConnected() then gpgs.leaderboards.submit({leaderboardId = "xyz", score = finishedSoManyLevels}) end end function loadLocalPlayerCallback(e) print ("gpgs load player") end function loginCallbackGpgs(event) print ("gpgs login") print(json.prettify(event)) uploadHighScore() gpgs.players.load({listener = loadLocalPlayerCallback}) end gpgs.login({userInitiated = true, listener = loginCallbackGpgs})
This is the log (I don’t know why login is called twice):
11-15 11:40:51.643 14463 14478 I Corona : gpgs login
11-15 11:40:51.643 14463 14478 I Corona : {
11-15 11:40:51.643 14463 14478 I Corona : “name”:“login”,
11-15 11:40:51.643 14463 14478 I Corona : “phase”:“logged in”,
11-15 11:40:51.643 14463 14478 I Corona : “isError”:false
11-15 11:40:51.643 14463 14478 I Corona : }
11-15 11:40:51.643 14463 14478 I Corona : _uploadHighScore 10
11-15 11:40:51.649 14463 14478 W plugin.gpgs.v2: Not connected
11-15 11:40:51.653 14463 14478 W plugin.gpgs.v2: Not connected
11-15 11:40:51.653 14463 14478 I Corona : gpgs login
11-15 11:40:51.653 14463 14478 I Corona : {
11-15 11:40:51.653 14463 14478 I Corona : “name”:“login”,
11-15 11:40:51.653 14463 14478 I Corona : “phase”:“logged in”,
11-15 11:40:51.653 14463 14478 I Corona : “isError”:false
11-15 11:40:51.653 14463 14478 I Corona : }
11-15 11:40:51.653 14463 14478 I Corona : _uploadHighScore 10
11-15 11:40:51.656 1331 7006 I ActivityManager: START u0 {act=com.google.android.gms.auth.GOOGLE_SIGN_IN pkg=com.google.android.gms cmp=com.google.android.gms/.auth.api.signin.ui.SignInActivity (has extras)} from uid 10152 on display 0
11-15 11:40:51.664 14463 14478 W plugin.gpgs.v2: Not connected
11-15 11:40:51.667 14463 14478 W plugin.gpgs.v2: Not connected
I was hoping for more details like you have it inside a scene:show() function or inside a button handler. I can’t tell the context you’re calling the login function above?
Can you build a simple demo app that has this issue that I can just drop my Google App Id into, change the leaderboard id and test and share that simple test project with us?
I took the code above, added some additional logging and a call to show the leaderboard after saving the value. I applied it to a game I’m building and everything worked as expected. The score updated. the call to show the scores worked.
I’m facing similar issues, did anyone find a solution to the issue? It seems as if it tries to connect and the screen goes darker for a second then nothing happens, but the console outputs the following:
02-21 13:21:26.523 25433 25461 I Corona : {
02-21 13:21:26.523 25433 25461 I Corona : “name”:“login”,
02-21 13:21:26.523 25433 25461 I Corona : “phase”:“logged in”,
02-21 13:21:26.523 25433 25461 I Corona : “isError”:false
02-21 13:21:26.523 25433 25461 I Corona : }
I also tried to use the old version of gpgs but that just resulted in my game crashing. I assume that the old version is no longer supported?
Can you add this line to the “loginCallbackGpgs” function?
print( json.prettify(event) )
This way you can see if you have actually been authenticated. “loginCallbackGpgs” will be called even if there is an error. So you need to check inside this function if you’re connected or what.
gpgs = require( "plugin.gpgs.v2" ) function uploadHighScore() print ("\_uploadHighScore", finishedSoManyLevels) if gpgs.isConnected() then gpgs.leaderboards.submit({leaderboardId = "xyz", score = finishedSoManyLevels}) end end function loadLocalPlayerCallback(e) print ("gpgs load player") end function loginCallbackGpgs(event) print ("gpgs login") print(json.prettify(event)) uploadHighScore() gpgs.players.load({listener = loadLocalPlayerCallback}) end gpgs.login({userInitiated = true, listener = loginCallbackGpgs})
This is the log (I don’t know why login is called twice):
11-15 11:40:51.643 14463 14478 I Corona : gpgs login
11-15 11:40:51.643 14463 14478 I Corona : {
11-15 11:40:51.643 14463 14478 I Corona : “name”:“login”,
11-15 11:40:51.643 14463 14478 I Corona : “phase”:“logged in”,
11-15 11:40:51.643 14463 14478 I Corona : “isError”:false
11-15 11:40:51.643 14463 14478 I Corona : }
11-15 11:40:51.643 14463 14478 I Corona : _uploadHighScore 10
11-15 11:40:51.649 14463 14478 W plugin.gpgs.v2: Not connected
11-15 11:40:51.653 14463 14478 W plugin.gpgs.v2: Not connected
11-15 11:40:51.653 14463 14478 I Corona : gpgs login
11-15 11:40:51.653 14463 14478 I Corona : {
11-15 11:40:51.653 14463 14478 I Corona : “name”:“login”,
11-15 11:40:51.653 14463 14478 I Corona : “phase”:“logged in”,
11-15 11:40:51.653 14463 14478 I Corona : “isError”:false
11-15 11:40:51.653 14463 14478 I Corona : }
11-15 11:40:51.653 14463 14478 I Corona : _uploadHighScore 10
11-15 11:40:51.656 1331 7006 I ActivityManager: START u0 {act=com.google.android.gms.auth.GOOGLE_SIGN_IN pkg=com.google.android.gms cmp=com.google.android.gms/.auth.api.signin.ui.SignInActivity (has extras)} from uid 10152 on display 0
11-15 11:40:51.664 14463 14478 W plugin.gpgs.v2: Not connected
11-15 11:40:51.667 14463 14478 W plugin.gpgs.v2: Not connected
I was hoping for more details like you have it inside a scene:show() function or inside a button handler. I can’t tell the context you’re calling the login function above?
Can you build a simple demo app that has this issue that I can just drop my Google App Id into, change the leaderboard id and test and share that simple test project with us?