plugin.gpgs.login() not responding

So in short when I call login function the listener function is never called. Init functions listener is returning no errors so I guess there is no problems with build.setting or configurations in google developers.

Here is my module for this plugin:

[lua]

local gpgs = require (“plugin.gpgs”)

local achievements = gpgs.achievements

local F = {}

gpgs.enableDebug()

– listener functions

local function loginListener(event)

    print("LOGIN LISTENER: ", event.name. event.isError, event.errorMessage)

end

        

local initCallback = function( event )

    print("EVENT INIT: ", event.type, event.name, event.isError, event.errorMessage)

    if not event.isError then

        print(“GAMECENTER: SUCCESS!”)

    else

        print(“GAMECENTER Error Code:”, event.errorCode )

    end

    if event.name == “init” then

        print(“GAMECENTER: LOGGING IN”, gpgs.isConnected(), gpgs.login)

        gpgs.login({ listener=loginListener })

    elseif event.name == “login” then

        print(“GAMECENTER: LOGGED IN?”, gpgs.isConnected())

        print("INIT LISTENER (login): ", event.name. event.isError, event.errorMessage)

    end

end

F.initialize = function()

    local function onSystemEvent( event )

        if ( event.type == “applicationStart” ) then

            print(“GAMECENTER INIT”)

            gpgs.init( initCallback )

            return true

        end

    end

    

    Runtime:addEventListener( “system”, onSystemEvent )

end

F.show = function()

    achievements.show()

end

return F

[/lua]

The F.initialize function is called in main.lua.

Here is log from device:

F.show is not working either but that is because you need to login first am I right?

Corona SDK version I use is 2017.3024

I followed this tutorial, but faced some problems. It seems that there are some bugs in GPGS plugin:

https://coronalabs.com/blog/2016/11/22/google-play-games-services-update-and-how-to-use-snapshots/

First I got an error: 

“errorCode”:4,

“errorMessage”:“sign in required”

Then I added userInitiated parameter:

gpgs.login( { listener = gpgsLoginListener,userInitiated=true } )

And got another error:

“errorCode”:8,

“errorMessage”:“internal error”,

I found a fix from this topic. At the moment even you won’t use Snapshot, you have to enable “Drive Api”.

After enabling, the app logged in nicely :slight_smile:

having the same issue what is the drive api and how do i turn it on?

  1. Go to: https://console.developers.google.com/
  2. Click Library
  3. Click Drive API
  4. Enable the API

Thank you @aatos media! This worked out great.

I followed this tutorial, but faced some problems. It seems that there are some bugs in GPGS plugin:

https://coronalabs.com/blog/2016/11/22/google-play-games-services-update-and-how-to-use-snapshots/

First I got an error: 

“errorCode”:4,

“errorMessage”:“sign in required”

Then I added userInitiated parameter:

gpgs.login( { listener = gpgsLoginListener,userInitiated=true } )

And got another error:

“errorCode”:8,

“errorMessage”:“internal error”,

I found a fix from this topic. At the moment even you won’t use Snapshot, you have to enable “Drive Api”.

After enabling, the app logged in nicely :slight_smile:

having the same issue what is the drive api and how do i turn it on?

  1. Go to: https://console.developers.google.com/
  2. Click Library
  3. Click Drive API
  4. Enable the API

Thank you @aatos media! This worked out great.