Android Google Play Implementation (leader boards, cloudSaves, SHA-1 signing)

1 favourites
From the Asset Store
A complete Carrom Board artwork for making an awesome board game.
  • Sup. So, I set out a few days ago to set up google play leaderboards on my android game made with construct 3. I had never done this before and began following the steps listed in the construct 3 manual to set it up. So far, I am unsuccessful. I'm sure I just did something wrong in the setup, and someone will be able to point that out, and that is the major reason for this post. But I also had some other questions about the google play features that I could not find much or any documentation for in the context of construct 3, and thought I would ask about them here.

    First: How do I get this darn leaderboard thing to work. So, I entered my application ID (android) in the plugin, created a leaderboard titled "Most Wins", wrote the script, and published the signed apk to an internal texting track with myself and all internal testers listed in the game services bug testing tab. Here is the script I wrote to test the system. Note that I waited a full day after publishing, and did update my app before testing on my android device.:

    When I run the program, In the home layout, google play tries to automatically sign me in. It fails, and after a moment, I return to my game. When I go to the leaderboard layout (where the script above is located) My app says "sign into google play to view leaderboards. double-tap to sign in" indicating that I am not signed in. So I double tap. Again, the google play bubble appears to attempt to sign me in, but then "failed to sign in" triggers changing the text to "failed to sign in to google play. Tray again layer". What am I doing wrong? Any Ideas?

    I only have one theory, and it has to do with the next question I have. \/

    Second: What is up with this SHA-1 signing thing? the manual kinda glosses over it. It says:

    "You will need to select an application that you have already registered with Google Play"

    And I did that. Then it says:

    "and provide the SHA-1 signature for the certificate you will use to sign your application."

    I was never prompted to do this and never entered one, nor do I know where I would get the SHA-1 signature from. Is it the same thing as my Keystore? It almost looked like google play already had the signature, as it displayed one at the bottom of a dialog box when I liked the app. I have not been able to find that string of numbers and letters since, nor did I take a screenshot of it. The manual continues:

    "Once completed, you should be given a client ID and application ID. For an Android app, you only need your application ID."

    And I was given both ID's. So, where was I supposed to do that SHA-1 thing? The manual states it is very important, and the game won't work without it. So, is that what my problem to question one is?

    Third: In the google play game services tab, in my app's game details tab, there is an option for "saved games". A quick google search revealed this feature is used to save your user's data to the cloud and is easily integrable. So. Is this something I can do with construct 3? and if so, how?

    Sorry for all the questions, but I found very little on all of these topics, so if any of you could help at all, thanks!

  • I hear you, asked about this on the forum 4 days ago. Hoping that someone who has managed to do this will answear.. :)

  • thx eski, at least I'm not the only one. That's Comforting. I have noticed that mobile features in construct tend to be a little less maintained by scirra. Not a huge surprise, as it is probably a lesser-used export method and other features need to be added in other areas, but still.

  • Ashley , hate to nudge you, but I doubt this post will be found otherwise. Thanks. Or maybe this is a better question for Nepeo. IDK.

  • haypers The signature is a unique string of letters for your keystore. If you generated the keystore with construct the download dialog for the keystore tells you what it is, and instructs you to stash it somewhere for later use. I expect most people don't read this dialog.

    When you create the "application" for Google Play games it asks you for the signature, but it doesn't explain why you need it and lets you skip entering it (despite it being a HARD requirement to get your game to work). It's quite awkward to find the place to edit this for your application, but it can be done.

    The signature is used as a check by Google to make sure that you signed the APK. When trying to sign in they check the signature of the keystore used to sign the APK against the one on record for the app ID. If they don't match the sign in dialog immediately exits, presuming it to be malicious.

    EDIT: Most mobile APIs tend to presume that they are being used by people experienced in building mobile apps, and hence are quite difficult to learn. Scirra have tried to simplify this for users but there's quite a lot which cannot be simplified, due to it being controlled by Google/Apple/etc.

  • Interesting. Thanks. I'll do some digging.

  • Ok. I get it now. So. Obviously, like an idiot, I did not save that string anywhere. However, when I linked my app to the game services, there was already a SHA-1 signiture entered in the box. I went back and looked at the prosses of making a new one to find this out. Was this just a randomly generated string?

    Either way, is there any easy way to fix this short of republishing the entire game? I could do that, I just don't want to.

    ThxNepeo. You are a lifesaver.

  • Are you using the Google App Signing service? This can muddy the water a little, because if you are Google resign the APK and then you need to use the signature for their key instead. It's possible that they would insert it into the field automatically if you are using it ( just guessing ).

    You can get the signature from a keystore or a signed APK using the "keytool" program that's included in the Java Development Kit ( JDK ). There's an explanation here. Unfortunately if you aren't familiar with command line tools this might be hard for you to follow.

  • So. I got good news and bad news. The bad news is that I am using Google play signing services. I apparently made every mistake this time around. The good news is I did some digging and found out two things. First, Google auto-filled the SHA-1 field for me. I don't know if this is the signature I made with my Keystore, or the one Google uses to resign my APK. Two, in the release management-app signing tab on the dev page, Google has listed an SHA-1 signature. Again, I don't know if this is my signature or Google's secondary one. However, I'm assuming Google is smart enough to auto-fill the link your app page with the correct signature. But, if they did, why is my app still not working... So... Basically, I'm still confused. I'll look into that tool later today.

  • Wait. I'm stupid. So in that tab, Google actually lists both sets of keys. They give you the keys they use to sign things a second time before release, claiming you need to use these to add API services, and another set they say came from you. So, I have both keys, and know which is which. So all I need to do is copy Google's key, and relink my app with it. Right? And if that doesn't work, I have a different problem.

  • OK! I got home today and took a look at this whole thing. So, It looks like the SHA-1 signature that google play automatically used to fill out the SHA-1 field when linking my app was the signature that google play uses to sign the app before distribution, because of my using of google app signing. So, that means, that the app is correctly linked to google play services. So, why am I still unable to sign users into google play?

    I have a few ideas, but I will need a day or two to test them out. Let me know if any of you have any ideas in the meantime. Thx everyone.

    Also, while I'm working on that, if any of you have looked into that "saved games" feature that google play offers, leave a post. I'd like to know how it works.

  • Cool. So, Yesterday and today, I when through all the steps again, and re-pasted every ID, Key, and piece of information I could. None of it worked. I went to the API console and messed with the auth page a bit trying to find out how to add the preview domain to the authorized URLs, and then saved it all and went to bed. This morning, low and behold, the leaderboard is working. Now, I have no idea what I did to make it work, but it is working! YAY!

    I still can't get the preview to work, but that's ok. At least I have the leaderboards working when exported to google play.

    So, now I am back to the original purpose of this post, which is to ask a few questions about the specific functions of the google play plugin.

    First, What is up with the saved games feature that I posted about toward the start of this thread?

    Second, Is there a way to set a leaderboard to only ever keep one entry from any player? One of my leaderboards is the top win-rates, and I want every player to have one place on it. Is this possible? Or is there like a way to delete your last entry?

    Third, can we get some more detailed instructions for how to add construct as a preview URL for google play leaderboards?

  • Where did you find a place for the preview URL? I can't find it. Does it actually work in preview?

  • The preview is not working, but when exporting to any track on the dev console, even internal, the board works. I haven't found where to put the preview URL in yet, but I've been messing with it a lot. I'll let you know if I figure it out. If one of the construct guys could take a look at the API site again, I think they would find that things have moved around. The instructions they have in the manual are clearly outdated. The tabs and directories are not named the same, and even if you find the right page, I don't think that is where you enter the URL anymore. I'll nudge a moderator in a few days if someone doesn't respond. I don't want to bother them more than I already have.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I think there's a bit of confusion here. The Google Play plugin supports 2 APIs. One for web, the other for Android apps. Web does not work on Android, and Android does not work on the web.

    They can both be setup at the same time and linked to the same leaderboard. But it isn't the simplest of setups.

    It's possible to setup the web version to work in preview.

    The 2 APIs have slightly different feature sets. There's a few actions marked "mobile only" which indicate these. For instance the web API does not support the "show leaderboard" action, because it's only available on Android.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)