From The Blog: New Google Play Games Services plugin

@Rob

Yes, the login works. What I meant was that it takes two attempt to successfully login. At the first attempt the usual process occurs - pop up to which account to login with, then the loading icon appears after that login is not successful. In the second attempt of clicking the login button, then I have successful login without any prompt. I tried it few times and saw it always takes two attempts to have successful login.

We would like to present an updated GPGS-v2 plugin with several common changes. First of all, let us thank all of you for helping us to make the new plugin more stable and modern.

Due to Google’s updated model of login and initialization practices and their vision for accessing GPGS API’s, we decided to remove the deprecated init() method where the GoogleApiClient is initialized. To use the new GPGS plugin you should only call the login() method instead of the old init() method.

Before, the isConnected() method had returned true only if GoogleApiClient had been initialized, but now isConnected() depends only on the availability of Google Play Services, so it will return true for all Android devices with the latest version of Google Play Services. We understand that these changes may break backward compatibility in your Lua code if you will try to check plugins functionality using GPGS-v1 plugin API calls, but it is necessary to migrate to the new plugin modern which is faster and more stable.

Best regards!

Are you saying we have to update all our v2-based apps again with the modified function call? I just submitted a few apps last night. Do you have sample code?

If your apps are working with the V2 plugin, then you probably don’t need to push out an update, however the next time you update, and build against the new version of the V2 plugin you will need to update your code to take out .init() and just call .login() if I understand things correctly.

Rob

@ Kirril

Thank you for the info. Can you please tell us when v2 plugin docs would be updated?

@Sheekore

We’ve pushed update an hour ago, but it has to take a while to update docs on the server side. Docs should be OK tomorrow

Hi,

I just tested the updated plugin with adapted code and it is indeed working. leaderboards start showing back :slight_smile:

Just confirming.

I notice it causes a crash when calling leaderboards.show() or leaderboards.submit() without logging in first.

Isn’t that kind of dangerous? I don’t remember how it was before. It could return an error event

@Kirill

The gpgs-v2 doc index page is still referencing to gpgs-v2.init function and gpgs.isConnected is saying will return true if user is logged in.
The doc shows that it has been updated on 1-nov-2018.

Is the doc being written for the updated plugin?  Because I haven’t seen any reference to the changes in the doc yet.

If you could please look into the matter. 

Thank you

@Sheekore, we will investigate what’s going on with the docs. In the meantime, this shouldn’t be a huge issue. Just follow the blog post and call .logiin() and remove your .init() call. 

Rob

@Rob

I am using 2018.3425.

According to the blog post I have removed gpgs.init and directly calling gpgs.login.

  • When the app is logged in then everything works that is achievements, leaderboards and snapshots are shown. When I logout , I cannot log back in again. This is due to the gpgs.isConnected ( I don’t know how to check whether the current user is logged in using updated gpgs-v2, I used gpgs.isConnected whether the user is logged in ) since it returns true always. When I close the app and restart again being signed out , when I go to the screen where I have the login button the app crashes giving the following error. When I tap the default prompt to restart the app, the app launches and the default the gpgs login procedure starts again, then after selecting the account, there is successful login to gpgs.

When I logout the whole app crash cycle starts again when I follow the above steps. 

error log:

11-02 20:01:28.217 11891 11907 I Corona&nbsp; : ERROR: Runtime error 11-02 20:01:28.218 11891 11907 I Corona&nbsp; : java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.ContextWrapper.getApplicationContext()' on a null object reference 11-02 20:01:28.218 11891 11907 I Corona&nbsp; : Java Stack Trace: 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; plugin.gpgs.v2.Connector.getContext(Connector.java:58) 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; plugin.gpgs.v2.Connector.getSignInAccount(Connector.java:62) 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; plugin.gpgs.v2.Connector.isAuthenticated(Connector.java:54) 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; plugin.gpgs.v2.Utils.checkConnection(Utils.java:52) 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; plugin.gpgs.v2.Snapshots.open(Snapshots.java:162) 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; plugin.gpgs.v2.Snapshots.access$100(Snapshots.java:36) 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; plugin.gpgs.v2.Snapshots$2.invoke(Snapshots.java:51) 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; com.ansca.corona.JavaToNativeShim.nativeTouchEvent(Native Method) 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; com.ansca.corona.JavaToNativeShim.touchEvent(JavaToNativeShim.java:430) 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; com.ansca.corona.input.RaiseTouchEventTask.executeUsing(RaiseTouchEventTask.java:39) 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; com.ansca.corona.CoronaRuntimeTaskDispatcher$TaskEvent.Send(CoronaRuntimeTaskDispatcher.java:170) 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; com.ansca.corona.events.EventManager.sendEvents(EventManager.java:91) 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; com.ansca.corona.Controller.updateRuntimeState(Controller.java:318) 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onDrawFrame(CoronaGLSurfaceView.java:425) 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1625) 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1380) 11-02 20:01:28.218 11891 11907 I Corona&nbsp; : stack traceback: 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; [C]: ? 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; [C]: in function 'open' 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; ?: in function \<?:786\> 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; ?: in function \<?:727\> 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; ?: in function 'method' 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; /Users/jenkins/slaveroot/workspace/Templates/label/android/platform/resources/init.lua:221: in function 'dispatchEvent' 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; /Users/jenkins/slaveroot/workspace/Templates/label/android/subrepos/composer/composer.lua:906: in function '\_nextTransition' 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; /Users/jenkins/slaveroot/workspace/Templates/label/android/subrepos/composer/composer.lua:1499: in function 'transitionNewScene' 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; /Users/jenkins/slaveroot/workspace/Templates/label/android/subrepos/composer/composer.lua:1531: in function 'gotoScene' 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; ?: in function '\_onEvent' 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; /Users/jenkins/slaveroot/workspace/Templates/label/android/subrepos/widget/widgetLibrary/widget\_button.lua:120: in function 'manageButtonTouch' 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; /Users/jenkins/slaveroot/workspace/Templates/label/android/subrepos/widget/widgetLibrary/widget\_button.lua:881: in function 'method' 11-02 20:01:28.218 11891 11907 I Corona&nbsp; :&nbsp; &nbsp; &nbsp; /Users/jenkins/slaveroot/workspace/Templates/label/android/platform/resources/init.lua:221: in function \</Users/jenkins/slaveroot/workspace/Templates/label/android/platform/resources/init.lua:190\>

I also struggled a lot with this issue.
W plugin.gpgs.v2: Not connected

But I found a solution. Maybe it doesn’t help you, but might be worth a look.

When you create a project in Google Play Console, a project is also automatically created in the Google Developer Console/Google Cloud Platform. This project is connected to your game through the signing key (SPA1). But when you release your game and choose to use Google Play App Signing it seems that the original key changes and you need to merge the upload.der with your original keystore.

When this is done, the fingerprint inside Google Developer Console/Google Cloud Platform no longer matches the one in Google Play Console.

So you need to update the OAuth credentials for the Drive API and Google Play Game Services. Inside the Google Developer Console/Google Cloud Platform you need to choose your project and go to credentials. There you should find an entry matching the name of your project.

If you click your project, you can update the signing-certificate fingerprint with the new one from Google Play Console.

Sorry for my English and probably not the best explanation. If anything is unclear please let me know and I’ll try to help you.
 

@steinovehelset

Thank you for your message. I am using 2018.3425 and with this build the gpgs.v2:not connected issue goes away. I am struggling with only how to check whether the user is logged in or not. If logged in, the gpgs functionality works as expected, only when logging out causes the issues I am having currently.

Hi guys, I’m using the 2018.3427 version and still get the “Not connected” message.
 
The relevant part of my code is:
 
 

if not event.isError then &nbsp; &nbsp; &nbsp; &nbsp; if ( event.name == "login" ) then&nbsp; -- Successful login event &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print( "AFTER LOGIN AND ABOUT TO SHOW LEADERBOARDS ") &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (globalData.gpgs.isConnected()) then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print("IT IS CONNECTED") &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; globalData.gpgs.leaderboards.show() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print("NOT CONNECTED") &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; end

 
And in the ADB Log I’m seeing:

 

I/Corona&nbsp; (32443): IT IS CONNECTED W/plugin.gpgs.v2(32443): Not connected

 
I’m also unable to see the Google Leaderboards. I’m assuming it’s related to being not connected. I’ve checked everything that was mentioned on this thread. I’ll try removing and recreating both the App and Service on the Google Play Console to see if that is the problem. If you have any other recommendation for me, please let me know :slight_smile:
 
Thanks.

I have also noticed that the “Drive API” in Google developer console isn’t always added automatically. So remember to check if this has been enabled. It may take some minutes from enabling before it actually starts working.

And you also have to remember to build the app with a release key, upload it to Google Play (alpha testing, internal or what ever) and download it from there. This was the only way I could make it work. Just transferring it to the mobile didn’t work.

No luck, I’m still stuck in the “Connected / Not Connected” issue,

@steinovehelset: I re-checked that the Drive API is enabled, and I’m building with the Release Key, so it’s not that. Thanks anyway.

Did you try to upload the build to Google Play, and install it that way? Just transferring it to your mobile doesn’t work!

Yes, I’m downloading it from Google Play as a Beta release.

I get to see the Google Play connection popup, and then the screen goes black and I get the “Not connected” error on the log.

Tonight I’ll try removing everything that it’s not relevant and uploading a single screen that connects to Google Play and submits a hardcoded score, using the code from the Tutorial.

Hi guys! I could solve my issue.  

I suppose it was a combination of things, but the last problem was that at some point I “restarted” everything on Google Play Console but I was using the old SHA1 key for my original app.  :unsure:

Thanks for your help!!

hi again everyone.

Is anyone having problem with isAuthenticated() function to see whether the current user is logged in or not? I am getting runtime errors when using isAuthenticated() since I always check whether user is in logged in or logged out state before using any gpgs function. When the app runs in subsequent runs if the user is in logged out state the runtime error persists always.  :frowning:

Here is a link to the detailed implementation of login code and logs i get.

Thanks in advance.