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

1 favourites
From the Asset Store
Math Signs Game
$8 USD
50% off
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported
  • Yeah, i try to avoid 3rd party plugins but rexs sounds like the one I need. I finally got motivated to work on my old projects and then something that was working fine decides to break again! Waaah

  • Ya, super annoying. It is not that I don't trust scirra's Google play object, I just don't want my users to be forced to go to several different places for different online services. I could not save the players progress anywhere online with the Google play object, so I just did it all with the same firebase database and rex's plugging.

    github.com/erenertugrul/construct-plugins/releases/download/rex_firebase/rex_firebase_pack.zip

    This is a link to all the current working c3 runtime Rex firebase pluggings. You can thank Eren for this.

    I've got savedata (saveslot), leaderboard, authentication, and API v3 all working together flawlessly in my project.

  • haypers cheers hopefully i can figure it all out! Save game data is definitely needed for my next game!

  • haypers know of any tutorials? One ive found mentions adding the app url to the plugin properties... what url does this mean??

  • Ya, I've switched to my computer for this post. get ready for a rant. And significantly less typos. So. Here is the thing about rex's plugins. They work great. Flawlessly. but rex himself only spoke broken English, and there are little to no tutorials besides rex's own site documentation, and like I said, its all in broken English. So here is a little overview of what got me stuck when I was in your shoes. I've spend weeks to months digging through the web to find this basic information. I don't want you to do the same. Once you have created your app on the Firebase console for free, the console will give you the URL you seek. Here is some information you will want.

    1 plugin properties:

    (all online documentation sucks)

    a: authentication

    Domain - leave this blank. it is a depreciated property anyway. its original purpose was to move authentication data from a root file in the data base to a sub file.

    b: API v.3

    API key: this is a key Firebase provides you to identify your app. It is a bunch of random numbers and letters.

    Auth Domain: the URL Firebase gives you for authorization. looks like this: GameNameAndID.firebaseapp.com

    Database URL: The URL of the database you make on Firebase. Only use original data bases. non of those fire-store things. Looks like this: gamenameandid.firebaseio.com

    Storage Bucket: the storage bucket location Firebase provides for you. looks like this: GameNameAndID.appspot.com

    Log: Keep this on 'NO'

    c: Save Slot

    Domain: the file directory within your database that the save slot data will be saved it.(leave blank to use the root location)

    Sub Domain: The sub directory within that directory (keep blank to use root location)

    d: Leader board

    Domain: the file directory within your database that the leader board data will be saved it.(leave blank to use the root location)

    ID: (sometimes referred to as the subdomain, because that's what it is) The sub directory within that directory (keep blank to use root location)(if you have multiple leader boards, this is where you would separate them. Change this value in your script via the set domain action to switch between leader boards.)

    2. Firebase database authentication rules:

    Every Firebase database has a set of rules that determine who can edit and post data to and from the server. If you know how to write these rules, great. If not, listen carefully: the domains and subdomains that you use for your app in various plugins will greatly determine exactly how you need your rules to be laid out. If you use save slot, its pretty easy. If you use leader board, its a little complicated. if you use both, you have another thing coming (assuming you don't know how to make these rules in the first place. Its not terribly complicated if you have experience.). I won't bother to post all the examples here, because that would take all day. If you go to the rules tab of the data base in your Firebase console, you can edit these rules. Mine look like this:

    {

    "rules":{

    "SaveSlot":{

    "$user":{

    ".read":"auth.uid === $user",

    ".write":"auth.uid === $user"

    }

    },

    "Leaderboard":{ ".read":true,

    "$gamemode": {

    "$user": {

    ".write":"auth.uid === $user"

    }

    }

    }

    }

    }

    This is set up to that my save slot, and leader board directories have different rules on how you can read and write to them.

    3.exporting

    a.While these things work flawlessly, for some reason, and I have no idea why, the construct 3 minification option hates them. When exporting, using complicated minification will make your apk not run. Simple minification still works though. maybe this will be fixed with the last update, IDK yet.

    4. tutorials

    a.They don't exist.

    b. Use the example projects that are provided in that zip file. That is how I figured most this stuff out. They are your biggest resource when it comes to learning how to use these plugins.

    5. worker mode

    a. never use worker mode when using any of rex's plugins. his scripts require the ability to send and receive data over the internet, and the scripts that do that require specific global access that the worker mode does not provide

    b. this should not affect your performance significantly.

    6. authentication services. If you wish to use Facebook or google authentication services to have players sign in, than you will need to go to that service provider and ask for permission. This is fairly complicated, and I never figured it out. I always just use email sign in, and have users create a password and email account. I could find no tutorials on how to get the google or other authentication services working, so I just don't use them. Let me know if you figure it out.

  • haypers LEGEND... thanks alot! that will prob save me a year of trying and giving up and trying again! After looking for info on firebase for a while now That was probably the best intro anyone will find. Ill give it a go tomo!

  • Anytime. Come back when you find something you just can't figure out.

  • haypers Oh of course i'm stuck already! Just testing basic log in with google behavior. Copied the simple example from rex, APIV3 set up the same (with my details), click a button > log in with google. Preview from construct editor works for the example but with mine the popup appears and instantly disappears without successfully logging in.

    I have linked the SHA Cert on firebase but that shouldn't matter as I am testing from the construct preview.

    Could there be any firebase setting up I have missed?

  • So, if you want to use Google API to sign in, you will have to use the Google API console and verify your firebase domain. While this is possible, I never did it as it was way to complicated and time-consuming. Instead, I have my users make an email and password login. While Google is convenient, I am yet to figure that one out all the way. I think there is an email login example cpax. Also, go to your firebase console, and check to see what authorization methods you have enabled in the authentication tab I think. Sorry it took a bit to respond. I've been in the mountains this week.

  • haypers Thanks for the reply, I assumed you had used Google for some reason. Looks like I should avoid Google, somethings definitely not right with it

  • ya. In Rex's example projects, It appears as though he had figured out how to do it, but I could find no tutorial for that functionality, and google themselves don't have a super user friendly interface for people like us who are trying really hard not to make game development complicated. I just have a simple 'create an account' page in settings that lets my users create an account, and in turn, use my online services such as saving data to the cloud, and posting to the leader board.

  • Nepeo Sorry to be a pain, tested out google play again.

    I published a duplicate of my game, exported as 'Signed Android App Bundle' instead of 'Signed release APK' and used a new keystore. Assigned new SHA-1 in the API console... Google play sign in and leaderboard now working fine... But this sucks because my downloads for this version are 1 (obviously) instead of 1000+

    Do I just delete my main version and start again or does anyone have any ideas why the previous build could be broken?

    Note: SHA-1 is correct in API console but I do have a warning about achievements not being correctly implemented, I have them set up but currently no calls from the game. This can't be the reason Google play is broken surely?

  • There should be step by step tutorial on how to actually use this plugin. I cant understand any info of this thread.. :D

  • I totally agree, Ekodesrianto. I spend almost a year learning things to get my project to work. It is so hard to use these plugins if you are new. The real problem is that construct 3 is yet to provide a real Firebase plugin, or any easy form of cloud save plugin.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello there,

    I'm having problem to authenticate the users using google play

    When I try to use the Sign-in condition, I get the error n 4 without any other information.

    So, I generate the key the first time I made the app, and I have been always use this key when I published the game (as internal testing).

    I see the SHA1 keys as in your screenshot, and the key that I use for the game uploaded has the same SHA1 of the uploaded key on the google play console.

    I added the id app and the id client from the service game page (the id client is a really long string)

    Do you have any suggestion on which troubleshoot I should do?

    Thank you!

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