Problem in opening Leaderboards on Google Play Game Services

Woo Hoo!

Hey, very glad to hear it!

Naomi

Can you not release an Alpha or Beta build, then publish it.  It won’t be available to the general public.  The GPGS part has a “Publish” too that’s separate from the actual app “Publish”.  I don’t think you want to do that until you’re sure you have things the way you want them.

Rob

Hi, Rob. I published the GPGS, but it didn’t have any effect; not working yet.

Debbuging on device, it shows I’m unable to login because the app ID is not registered.

Can you post the exact message you are getting?

And just as a confirmation, I just manged to get my test account logged in to GPGS.  Once I created 5 achievements and a leaderboard and a test account, I had all green check marks, at which point my login worked all the way through getting the results from loadLocalPlayer.

GPGS isn’t the easiest thing to set up.  There are a lot of steps involved before you even get to the Corona SDK side of things.

Rob

It seems I don’t have a debug SHA1 code for the debug key. I see my previous game console on Google APIs had two SHA1, but I don’t remember having to create one else.

The SHA1 is for a release keystore only.  The reason for this is unless Google changed things, once you set it you can’t change it.  There is no way to start with a debug keystore then move to a release one.

I noticed when I was setting up my game recently however, that if I told Google to use the Package ID it found the game I had uploaded in Alpha state and got the SHA1 key for me.  I went through the process of rendering it from the command line and noticed it was identical to the one they pulled.  

Rob

Huuum! I think I understand it. I’ll release the game and see what happens.

Thanks, Rob. 

Have a great day!

Bob, I launched the game to the Play Store, installed the game and even after that I couldn’t sign to the GPGS.

It keeps prompting the log that the app ID is not a registered one, so I had to remove the app from the store…

This is the only ID I have on the app Google Developers Console:

7xxxxxxxxxx0-mg9i335uo25ganb4gguinhferf6fqnr7.apps.googleusercontent.com.

This is the ID I got after using keytool -exportcert -alias my_key_alias -keystore my_keystore.keystore -list -v

My previous game has two: one with the “mg9i335uo25ganb4gguinhferf6fqnr7” (not the same digits) and one without.

What am I doing wrong?! 

Hi Wiler, the ID you posted is the Client ID.  Your appID is 7xxxxxxxxxx0 part only.  

You can see the same appID by going to Google Play Developer Console > Game Services > Your App.  It is displayed right next to your app’s display name at the top of the page.  

You don’t have to publish your game to test leaderboards and achievement.  

I believe only time you need to publish before you can test is the in-app billing, but you can test it with published Alpha version without publishing the app to production.

I hope this helps.

Naomi

Hi, Naomi. Thanks for the reply.

In my build.settings file, I’m using 7xxxxxxxxxx0. As I said, I have an app which has two Client IDs, but this one I’m working on has only one. I don’t remember having to create two SHA1 certificates…

I tried signing in after releasing, but the same error came out…

Hi Wiler, each keystore has a unique SHA1 certificate, so I don’t think you can create two SHA1 for a single keystore.  You may have created two Client IDs, but don’t worry about it for now.

I had trouble with signing into GPGS too, and I was seeing the “Google Play services resources not found” error on terminal.  So I thought there was something wrong with my keystore, SHA1, ClientID, etc. – but I could not find any reason why my Google Play setup was wrong.  It turned out this particular error was to be ignored (because it is a false alert.)

Between GPGS and iOS Game Center, there is a slight difference in how init and login have to be handled.  I’m wondering if you’ve made an iOS version first and is now using the same/similar code to handle GPGS version too.  (I had a couple GPGS version done in the past, but they were more involved with GPGS multiplayer mode, so with my latest app, I copied iOS code for the init and login request, thinking it’s the same – but this assumption caused me grief.)

Anyhow, the difference is, with GPGS version, gameNetwork.init returns event.isError only.  Unlike iOS version, it does not return event.data – so, if you do not request login until event.data is returned, you will not be able to login.

Also, at the very first launch of the app, before a user has a chance to request the login, you want to use the following:

[lua]

gameNetwork.request(“login”, { userInitiated = false, listener = loadLocalUser })

[/lua]

But the above is likely to fail.

However, if the login request is made with user’s permission, you can use the following:

[lua]

gameNetwork.request(“login”, { userInitiated = true, listener = loadLocalUser })

[/lua]

With this, the login request will succeed so long as you have called gameNetwork.init( “google”, initCallback ) at the launch of the app and event.isError did not return true.

I hope this makes sense to you somehow.

Naomi

I had no contact with iOS yet.

I use the following code to access the GPGS. Is there some error? It works fine for my previous game. 

gameNetwork.init("google"); local function googleListener(event) gameNetwork.show("leaderboards"); return true; end function showLeaderboards(event) if(gameNetwork.request("isConnected") == true)then gameNetwork.show("leaderboards"); else gameNetwork.request("login", { userInitiated = true, listener = googleListener }); end return true; end local leaderboard = widget.newButton{ defaultFile = "leaderboard.png", overFile = "leaderboard-over.png", width = 92, height = 46, onRelease = showLeaderboards }

You probably want to call gameNetwork.init in main.lua upon launch of the app.

In my game, I have a GPGS scene, where I have three buttons:

  1.  Leaderboards

  2.  Achievements

  3.  Sign In  (and if the user is already signed in, it changes to “Sign Out”)

If a user taps on Leaderboards or Achievements before signing in to GPGS, I alert the user to sign in first.

Anyhow, in the thread I dealt with my issue, Christopher provided a sample project that works:

http://forums.coronalabs.com/topic/50011-resolved-gpgs-gamenetworkinit-does-nothing-with-an-error-google-play-services-resources-not-found/

A link to his sample project is at the bottom of the first page.  Follow his detailed instructions, and you should be able to sign in to GPGS with your keystore and appID.  Once you have the sample project working, compare the difference between your code and his.  You should be able to quickly identify the issue and fix it.

Naomi

Huuum! I used his sample project. It seems the problem is one step closer to the solution. The problem now is that the logcat shows my application ID is not associated with the my game package, when it’s not true. And it also shows it’s unable to load metadata for game… I created another project, with another API key and another keystore, but I got the same error. I can’t understand what’s wrong…

Okay, here’s what I’d check.

Go to Google Play Dev Console > Game Services > Your Game > Linked App

On that page/screen, you will see both your App ID and your game package.  Check to make sure you are using the matching App ID and package.  Also make sure you’ve got all checked/marked green if you haven’t published the app yet – if you’ve already published the linked app, they’re probably all good.

Naomi

P.S.  Also make sure you are using the matching keystore when you generate a device build.  If you use a wrong keystore, it wouldn’t work either.

Everything you said is done, Naomi, but it still shows no work… :confused:

That is strange.  When you mentioned you created a new keystore for a new package name, did you also add a new app (with new package name and new keystore) to Google Play, created a new app under game services, and linked the new game services to the new app?

In my case, when I created a new keystore for a new package name, I also added a new app to Google Play, created a new app under game services, and linked this new app in game services to the newly added game – basically, I used the new set of package/keystore for my test.  And it worked.  Then, it turned out, the real game project that I had trouble with also worked once I sorted the event.isError vs event.data issue related to init and login.

Anyhow, here’s what I did with my new test project/game with a new set of package/keystore:

* I uploaded a new APK file that I generated with new package/keystore for Alpha testing (but NOT published )

* I filled out store listing

* I filled out pricing for the game

* I even filled out in-app product (and made it active) – which isn’t necessary for your testing

* Under the game services, the new game is NOT published but has:

     - Game details filled out (check marked green)

     - Linked apps filled out (check marked green)

     - Events not added (check marked green)

     - 5 achievements added (check marked green)

     - 4 leaderboards added (check marked green)

     - Testing shows a few testers (check marked green)

     - Publishing (check marked green – shows “Your game is ready to be published”)

If all of the above is the same with your new keystore & package, will you try just once again, making sure that:

  1.  you use the new googlePlayGamesAppId in build.settings

  2.  you use the new google key in config.lua (although this may not affect GPGS sign-in process)

  3.  you use the new leaderboard and achievement IDs

  4.  you use the new keystore when you generate a device build

  5.  you login to GPGS with tester account you added to the Testing section of the game services

Naomi