Jump to content

Google Play Leaderboard for Javascript HTML5 Submit Scores issue


Three Brothers Apps
 Share

Recommended Posts

I am trying to implement a Google Play leaderboard in a very basic javascript game:

I have included what I think are the necessary meta tags, signon, and scripts in my index.html file:

<meta name="google-signin-client_id" content="xxxxxxxxxxxx-xxxxxxxxxxx.apps.googleusercontent.com" />
<meta name="google-signin-cookiepolicy" content="single_host_origin" />
<meta name="google-signin-callback" content="signinCallback" />
<meta name="google-signin-scope" content="https://www.googleapis.com/auth/games" />

I've included a standard google sign on button:

<div class="g-signin2" data-onsuccess="onSignIn"></div>

I've included the google apis:

<script src="https://apis.google.com/js/client.js"></script>
<script src="https://apis.google.com/js/platform.js" async defer></script>

In my games.js file, I've included the call to submit the scores by:

gapi.client.load('games','v1',function(response) {

  var request2 = gapi.client.games.scores.submit(
    {leaderboardId: "xxxxxxxxxx",
    score: 50}
);
request2.execute(function(response) {
  console.log(response);
  // blah blah blah
})

But nothing ever shows up on the leaderboard. The console log spit out what I'm expecting. I've confirmed the clientID and leaderboardID.

For some reason the scores aren't actually being submitted (or if they are, they aren't being processed). Anyone with experience setting this up available for some pointerd? Note that this is not a chrome app/extension - it's a pure javascript game hosted on a web server.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...