GPGS connects, but doesn’t login

Hello,

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

@philipp3

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.

This is the code:

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

Can you show your code where you’re calling login?

Rob

I updated the code above.

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?

Rob

I don’t use scenes or anything, this is the code how it appears in main.lua. It’s not inside a function and has no delay.

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?

Thanks

Rob

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.

Rob

I was trying to make a small isolated demo project, but still no luck for me. I am getting “plugin.gpgs.v2: Not connected” every time.

Could this also be an issue of build.settings, or the Google login?

This sounds like something local to your setup… There are several steps that are easy to miss in the Google Play console.

Rob

I see, I will take a look at the console again.

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?

@philipp3

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.

This is the code:

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

Can you show your code where you’re calling login?

Rob

I updated the code above.

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?

Rob

I don’t use scenes or anything, this is the code how it appears in main.lua. It’s not inside a function and has no delay.

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?

Thanks

Rob