Godot Google Play Services on Android in 30 minutes!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys i've been getting quite a few questions since my last video about android and various goodo integrations so i thought i'd figure a lot of it out for you guys and uh show you how it works because i i wasn't sure myself i haven't done too much android development in the past and it sounded like fun so where i started in this video i'll be showing you how to add google play services to your android projects and we'll go through the android custom build system and set up our project within google play console and google cloud console in the next video we'll add achievements and leaderboards and following that sometime in the future we'll look at admob integration as well as in-app purchases so without wasting any more time let's get into it okay so the first step that we're going to need to do is to fix a mistake that i made last video as i said this is a learning process for me as well so last video when we installed the jdk we installed jdk 11. now there's an issue with jdk 11 that some android tools will not work with jdk 11. so what you will need is to reinstall uh your jdk with open jdk8 so you download this and then also reinstall android studio so i would come in here i wouldn't i would uninstall adopt open jdk and uninstall android studio and then reinstall it with uh japan 11 and the same settings last time for android studio so that should fix your issue um if you run into any issues other than that let me know but that's all we need to do all right now that you've got your um environment set up properly the next step we're going to do is we're going to go to play.google.com console it should come up to slash developers but you can do slash developers as well and you're going to be greeted by some sort of screen if you don't have a developer account i imagine it's going to ask you to create one and i believe at this point it will ask you for like 25 or something like that unfortunately it's not something you can skip so give them your money and continue on once you've created your developer account you'll get a page like this and you can go into it by clicking it i've got a previous version here but what we're going to do is we're going to create a new application so our app name i have it here i create a new project to set it up we're gonna call it godot adventure time which is going to be um that a newer version i think of that android platformer demo from last time uh we're going to add google play services to it so first thing we're going to do is we're going to set it up as a game and it's going to be free once you publish you can't change okay so we're not publishing yet anyway so that's fine uh we meet all of the rules and we'll create the application so once your application is created all we need to do at this point to set up our to get google play integration to do our testing is going to be uh on the left sidebar at the bottom you're going to see play game services hit the configuration button so you'll get the page that looks like this does your game already use google apis so since we're doing a no new game we'll click no uh if it's you're migrating a previous project or something like that or you're already using google map apis or something like that um you would click yes but we're creating a new one so when we hit the create button here all right so our game has been created what you're going to want to do is you're going to take note of this uh project id here you can always come back and get it later though so when on the screen what you're gonna notice is you're gonna see this uh configure your oauth consent screen before adding credentials so when you click this it's going to tell you that you have to go to google plus cloud platform to do it so you can go into your google cloud cloud google cloud platform from here and you will have your project selected if it's not selected what you can do is search inside here search your project in here sometimes it won't show up without searching click it and click open and then click this oauth consent screen on the left side now if you're creating an application that's only for let's say you're making an internal application to manage your employees and only your hr department's ever going to be allowed to use this application you'll create an internal application your external application is what most people will do and you also need a special uh g suite organization account to use the internal so click external hit create so this will give us this where we'll have to create all the information so we're going to call this godot adventure time uh support email is you're going to have um emails in this list if not i imagine there's going to be a link for you to see set it up for the app logo um i believe that i will just use this that works for the application domain so the web page we're just going to use our webpage and for here on domains we're going to also add our domain here now developer email address we're going to use the same one as before oops that's dumb okay gmail.com all right and then save and continue now we'll say verification required but whatever it doesn't matter hit you're going to want to add remove scopes so what i usually use is i will um i usually don't want their email address because unless you're um you know you want it for marketing purposes but i generally don't like to take people's email addresses so i would go with create the game create your own google play games activity uh this is the light version of it so i would grab it as well never use i would never click the personal information button people will be mad at you and also if you're interested in saving application data i would click that one as well hit update on that and then you can save and continue on that and this is optional information and let's just prepare for verification that's fine you go here it'll say you can go back to this manual consent screen look at verification status and it should say prepare for verification now the next thing we need to do after this is to create a set of credentials for you to um access your your play services so go into credentials you're gonna see uh it says this needs to be verified but it's fine just create create credentials create your credentials then add oauth client id web application type android name adventure time debug and we'll say android just in case we want to make it cross platform and we need to do it so your package name is important this is a java package name so you can look up how to those are generally named but it'll usually be your donut domain so the dough dragon bones and then we're going to say godot adventure and then we need your deep your key key store fingerprint so they give you the command you need so you have this here so what you're going to do is again you're going to want to open your terminal which i showed you how to do last time and then you should have you should still have your debug keystore here so you're going to want to go key tool keystore debug.keystore this will be this will be the full path to your keystore list v you're going to enter your d your store password which uh for the debug this is the same one we created last time it's called android and you're going to want to take this sha1 certificate fingerprint here copy that with this terminal just right click the copy and then paste it in and hit create there we go now it's important um when you look here that you remember this godot dragon bones godot adventure package name you'll need that in godot so with those two things done with on the google cloud google cloud platform um we go back to the google play console this is fun to say and just refresh the page so now you'll see that uh you don't have that oauth consent form here anymore what you do see however that you need credentials so hit add credential here boom then hit games then hit android you can do adventure time debug and if you want it to be limited only to google play you can use this i personally don't care in this instance and you'll select that um credential we made in the cloud platform uh here under oauth client at the bottom if you don't see it hit refresh oauth client or if you do it out of order and you go into the cloud platform create it click refresh with that done hit save changes and there we go so we've got everything we really need set up here and now we'll go back to this configuration and what now you'll notice that this still says draft we need to get this po this specific area published for us to be able to use it so hit review and publish you'll see credentials are good but we need to uh do a bunch of description stuff so what we're going to do is we're going to click one of these arrows and we got to fill out all this invented all of this information so our description we're going to say this is an amazing 2d platformer game created by some awesome folks at the goodwill engine.org workplace place created as a demonstration of google play integration okay in game category i will assume adventure i can't i'm surprised there's no platformer here but casual i don't know adventure save games um so save games you can start with it off or you can start with it on but once it's on you can't turn it off so i if you don't need it keep it off for the game icon what we're going to do is we're going to create some icons real quick okay so let's create some icons now that i've got paint open um let's first we've got the game icon it says it should be 512 by 512 so in paint i'm just going to do this and again you're going to want to do this properly later but if you're just trying to do the get it integrated first and deal with all this meta stuff later you can do it like this so let's just say that our icon is going to be a black square with um let's say a blue here and a good dough nope i want a thicker good dough adventure get so that's that's that's gonna be our logo so we are going to put this and we'll just name it logo here and we'll upload it let's call it here and now if you really want to be lazy about it like i i will we can resize this to the new size so it's going to be um 1 10 24 by 500 so just hit resize take off maintain 10 24 500. okay save that upload grab it and we're done so uh if you have firebase um you can add it here later and the google platform project it's already connected that um it created that for us and we were already playing in that so hit save changes so uh we've got all that done we'll go back to configuration here go back to review and publish now we get ready to publish hit the publish button and hit publish game project and there we go that's everything we need to do inside google play game services causal so um the next step we're going to get into is uh setting it all up in your godot project okay so now that we have everything good to go in our google play console uh what we're going to do is we're going to jump over to godot um so what i need to do is get my desktop go to godot and you'll see we've got a oh that didn't change godot adventure time here so we'll change a few things inside here get it all ready and uh make it good to go so the very first thing we need to do is go to the godotdragonbones.com website or if you're using the rig the regular uh godot engine you can go here and download export templates download and i believe they're here this button here whichever one you want um and yeah so with that you will go into godot here we're going to hit project install uh editor i mean manage export templates and you're going to want to uninstall anything you already have um and reinstall the templates here so the reason we're reinstalling them is because there was missing a file it was pointed out to me by a user on discord i don't remember what it was i believe it was canaz something like that um thank you by the way um so i've added a file to that and now it will work and we're able to hit this install android build template button so click the button it will give you a warning saying that blah blah blah and you've got to select the use custom build option when you're using the android export preset so hit install it will export a bunch of stuff give it a minute gives it a minute it should be happening and he said there it is so android and you see we we now have a plugins folder so the next step that we're going to do is we're going to um we are going to create our export template for now so we want to click add android uh you're gonna hit this use custom build we're gonna come back to this page later and in your unique name you're going to want to use the package name you selected for your credentials inside here so here you see i chose this package name here put that inside game name godot uh adventure time there we go and that's all we need to do now if everything has been set up properly let me do this now you should be able to plug in your android device on into your computer now and you might get a you might get a warning asking allow debugging uh on your device hit okay hit yes give it access and you're gonna see this little android button uh up here on your godot there you go i don't i didn't want to build it damn it anyways you'll see the android button show up and you'll be able to push your projects to uh android so uh let's just wait for this sometimes this will uh freeze up with when trying to deploy android stuff give it a minute especially the first time um get a minute it'll come back when it comes back we'll continue with the tutorial well you see it started working as expected and it's it's sending it over to my android device i don't remember clicking this button but apparently i did so um just waiting for that it says installing to device inside your on your android device there's a couple of settings you'll need to do you'll need to let me turn turn that sound off it just started on the device so you're going to need to turn on developer mode and also enable install from usb um in your debug in your android developer settings so um you should you might i might be showing um what i had to do on my phone to do that anyways so now that we've got it deploying to android we've got everything working fine and it's running the custom build uh the next thing we need to do is add all of the files and set up the google play services okay so let's get into adding google play services so the first thing we're going to do is we're going to go to this website here i'll leave the link in the description uh github.compgsgp this is a godot play game service plugin for godot so self-explanatory it gives you all the instructions you need here so the code that i'm going to be inserting you can get the generic versions here but to get started what you're going to do is you're going to hit this tags button you're going to click releases and you're going to download these two files the gdap and the release.aar and what you're going to do is as i've done in here uh you'll go into the you'll paste them into the new plugins folder that was generated for you when you installed the the android build template thing so we're going to add android plug-ins and paste into here now i would suggest opening uh visual studio code probably is your best bet here to do the next few steps so the first thing you're going to want to do is in your android build folder you're going to want to add a new folder called uh res for resource and then inside that folder you're going to want to create another folder called value and inside here you'll make one more one file called strings.xml now your strings.xml file it will contain let's go back to the main page of the repo it will contain this xml version uh string here so you can just paste that in and you'll see there's add your app id so earlier i told you to note down this id here your project id so just copy that and you can add that to uh within here so don't make sure not to add any spaces or anything and hit save that's it for that file one last thing we need to do we need to go into our androidmanifest.xml and right here where you see these metadata tag tags add a couple spaces and go back to again the main thing and you'll see these two metadata tags here and you can just paste these in as is you can paste these in as is right here and you know probably so what this does you'll see um i'll just make sure that the spacing's the same on both that it's going to look for the app id in string app id and if you look in here that's what we created here and then here android value integer google play services version i imagine that this is defined somewhere else within this uh within the plugin i'd imagine probably in here when it loads so just save this file and that is everything you need to do to install google play into your godot project so now that all of this has been added we can now go into the game itself and start adding what we need to actually load google play when we start the game alright so now that everything is inside here we're gonna go back into the export templates here or the export presets and you'll see inside um where it showed custom build we've now got under plugins google play game services check that box and you can close that we would need to make sure that's enabled you'll get that option as soon as you drag those plug-in files into the plug-ins folder so with that done we're going to do we're going to add a new folder and we're going to call this uh let's just call it integrations and inside here we're going to create a new script oops new script google play so we've got a new google play script here which we're going to add to our auto load so it'll load automatically so we'll go into project settings go into auto load select our integrations google play call it google play hit ok and we're done so now let's open that script and get it working so it's fairly simple the first thing we're going to do is we're going to want to load uh load google play so hello we're going to sign in actually so we're going to go in it and sign in that actually we're going to make this two different functions because sign in is going to be a public function that we can call when we need so we're going to call this init like this and funk sign again okay actually get that got rid of the air so for emitting our service so first thing we're going to do is we're going to do a play services equal no and in our init function we're going to go if engine dot has singleton there don't play games services make sure to spell that correctly and then play services equal play games services let me just yeah so sorry play services equal engine dot get singleton you could go play games services and then we will initialize the plugin so we've got a play services init and true for show pop-up that's all i want side unit function and then our sign-in function we're gonna go if play services then we will sign in which is play services dot sign in so that's all we need to really sign in and in it initialize the services but we want one more step is we want to we want to connect signals so let's connect our signals func connect signals again we'll make this void and we are going to uh first let's move private functions to the bottom public functions at the top just something i like doing so if play services dot dot connect on sign in success self on sign in success won't do many s's we'll call this fail and we'll call this fail and we'll create these functions so um these functions have a signature like this so you get funk let's just copy paste that so here you have account id as a string and we'll do the failure the failure has error code as an integer so this this will be easy enough we're going to go uh we'll just do a print successful sign in i don't want to print the account id because it's going to be mine and failed to sign in fail to sign in with error code error code all right and that should be everything we need to uh initialize and sign into google play services this will be everything that i will be going over today but uh let's just show you what it looks like when it's running on the device so you can verify that it's working properly all right so hit the button it will compile and we should get a welcome to google play services uh message so let's just wait a minute and see how it goes again you might see it uh go into this uh not responding state just wait it out be patient and then it'll it'll uh update itself like this so i'll sign it and verify the apk it's going to open it and we should be good so it opens it and you see it tries to sign into google play and it signs in properly and we're done so if you look here um it's not the debugger didn't attach properly uh the console it's not printing to debug you can because you need to deploy with a remote remote debug when you do that as well if you don't have that and you just want to do it manually you can do adb devices but you can also do adb log cat dash s godot i believe yes maybe so let's uh let's close close the game out uh let's deploy it with remote debug it's possible that we need the remote debug to be able to um do it so let's deploy with remote debug now that's already compiled that takes it's much quicker to do we should we should see the successful sign-in message come up successful sign in perfect and again now you can if for some reason it doesn't show up here should be able to do that same one we had before and you'll see now we get godot messages in here so sometimes uh when you shut down or redeploy or whatever your debugger won't connect properly to to uh adb uh to your godot listener so you can do adb logcat um to get those messages so what's the message in objective dna i see an attempt to connect non-existent onside and fail so i misspelled that so you want to do on time and failed and that that air is going to go away so um as you can see running on the device everything's running now okay so it logs in it goes and we should be able to move there we go probably that error that i just fixed can we kill stuff no they don't i can ride them but i can't kill them and we've got moving platforms so there we go and we have google play game services okay so with that you have every all the information you need to fully implement google play game services so if you want to look up this stuff on your own before i get to it you can look at the readme at the front page of the plugin and explain to you how to connect everything and all the different function signatures so that's pretty much all i've got for you today thanks for sticking around and as always i hope this video has been useful to you let me know what you'd like me to cover next in the comments below or at my discord i'll try to get the next video out sometime before christmas when everybody gets a little bit
Info
Channel: Ozzadar
Views: 5,666
Rating: undefined out of 5
Keywords: Godot Google Play Services, 2d skeletal animation godot, godot skeleton 2d, godot bone animation, COATools, godot 3.1 skeleton, godot, 2d, animation, skeleton, dragonbones, getting started, godot engine, godot tutorial, dragon bones, game development, game dev, Godot 2d, 2d skeletal animation, godot game engine, godot 2d, tutorial godot, godot 2d tutorial, godot animation, godot spine2d, godot spine, godot android, godot google, godot leaderboards, Godot achievements
Id: Y3Bj7qww0Y0
Channel Id: undefined
Length: 33min 38sec (2018 seconds)
Published: Thu Dec 03 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.