Advanced Godot | Showing Local Android Notifications With Godot 3.2

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys this is mitch with findpoint cgi and today we're going to talk about making local push notifications for android inside of godot so we're going to go through the process of setting up a custom android plugin which i will show you guys in a minute and we're going to talk about how to compile your own android binaries versus using the android sdk which is what we did in our previous video so that's what i got in store for you guys so let's go ahead and get started okay now that we're in good dough the first thing that we're going to need to do is we're going to need to set up a custom build environment for android now godot has made this really easy what you can do is you can come up here to project and install an android build template so if you click on that it'll tell you that there's a confirmation hey you need to you know you need to make sure that you you do this specifically right like you can't just do this willy-nilly right you need to know what you're doing so go ahead and click install and it'll go ahead and uncompress it and throw it into your project see here that uh it pops up right here so android plugins so that's exciting if you haven't seen my previous video of exporting to android with godot i'm going to link it to the top of the little dooblydoo up top and in the description below so you guys can go ahead and check that out make sure you run through that before you do this tutorial but once we have this part done go ahead and click on editor editor settings and then we need to come down to android and then we need to give it a custom sdk build path so what we're going to do is we'll go ahead and click on our little um file browser and you can see that it's already kind of got an idea of where we want to go but let's go ahead and open up a web browser here or not a web browser a file explorer you'll see here's my file explorer and what we'll do is we'll go to c uh users your name app data local android sdk and then we will go ahead and copy this let's go ahead and copy this paste it enter and then select that as your current folder so now you can go ahead and hit close and let's go ahead and quick quickly create a small 2d scene so let's add a button here so that way we have um you know something that we can kind of see while we're playing around in this environment so what you should see is if you go to project export and you add in an android one you should see this currently now what you need to change is if you go into your options here and then you scroll down you should see use custom build make sure you check that now when you go ahead and export your project and i will just put it into my github folder location and i will call this my android export demo project custom build oh my goodness i can't spell when you save it you'll notice that here it's actually building the android project so this is how you go ahead and add your own android plugin so you can add in all these different things where you could actually you know go and interface with android directly so if you wanted to create a small little jvm right that that receives push notifications from a server which i will create a video on that sometime in the future i'm sure but it allows you to do all these different things like adding ads which again i'm going to create a video on that as well it's really cool way to allow you to build your own custom android applications using godot so i'm going to go ahead and let this download run through and we will go from there and make sure you allow access and stuff like that so that way it can it can do its thing so i'll be back when it's done thanks okay so now that it's finished uh if i go out to my github folder which is right here you will see that i have it android custom build apk so if i go ahead and run this a second time just to kind of show you what it's going to look like this is how it's going to look every time you export but if you click export custom build yep i'll overwrite it you'll see it's going to come up with all these different tasks and stuff and it's going to download and install the gradle add-ons and things like that that you're going to need every single time you want to build out an apk so this is just something to keep in mind that you're going to see this every time you do your android plugins and every time you do an android build so now what we're going to do is we will go out to get dr morty native lib ui so the reason why we're going to use this is because it's going to be easy for us to download and add native libraries for um our ios and android and things like that so what we'll do first is we're going to go click download and download a zip and just go ahead and save it i've already done that and go ahead and extract it so once you download and extract it you should have something kind of like this so it should just have add-ons native lib and you should see a bunch of stuff so we're gonna do is we will copy this add-ons folder here so ctrl c go out to your project location so in my case it's documents github and i believe i'm using my particle demos project for this we'll go ahead and paste this in and you'll see that there's an add-ons uh folder now so now if we go back into godot what we can do is we can see if we go to our project project settings and our plugins you'll see that we have this native lib here so go ahead and enable that and close uh it's gotta think for a minute all right now once it's installed and closed you can go ahead and click on native lib now you can see that mine already has been set up but what you'll need to do and i'll reset all of this for you to kind of take a look at it so what you need to do is you need to click on select python you need to go find your python instance now in my case it was [Music] see users not public uh here app data local programs which is [Music] programs python python and then there's your python executable so you'll need to just copy this minimize this and then control a control v python and then you can just select your python executable right here so open and that'll select your python and then you want to come down here and you want to click this late of nib or native lib cli utility click that it'll install your native lib and then click the repo button and it'll refresh all of these repos and then you'll want to make sure that you click this little button here and it will enable android support and if you click this it'll enable ios support so if we scroll down here you'll see there's local notifications right here so what we'll do is we'll go ahead and click install and you'll see that it's going to take a few seconds but it's going to go ahead and install it so you can see here if i click down on add-ons native or i'm sorry on android you'll see if we actually open this file manager you'll see that there's a local notifications gdap and a releases aar now what that means is now if we go into our project and we go into our export and click on our android you will see that there is a plugin for local notifications so let's go ahead and turn that on so you want to make sure that you do this because if you don't then your project won't work with notifications so go ahead and click close and then what we'll do is we'll click on our button we're going to go on button up connect and i will call it uh oh actually first i'm sorry we need to go ahead and add a script so we'll just call this main [Music] project controller and then what we'll do is we'll click on this button and we'll do a button up connect and then we're going to call this on notification button button up then what we're going to do is we need to first make sure that we have that binary available to us so we'll do if engine dot has underscore [Music] single ton and then what we're going to do is we'll type local notification what that's going to do is it's going to tell it to say hey if this exists if local notifications is available to the systems then go ahead and send a local notification so the reason why you want this is is so that your system doesn't um attempt to send a notification when um the notification system isn't available for instance if you're on desktop or something like that so what you need to do is you need to type var ln for local notification is equal to engine dot get singleton local [Music] notification and then ln dot show local and o t i f local notification and then we're going to put test comma test body comma and then the time so we'll say two seconds comma one so what this is is it's the title the body the time it takes to um deploy that notification and then the um priority of that notification is the user going to be notified or just going to be silent kind of show up and not actively notify the user so and we will actually go ahead and comment this so this all right and unfortunately you don't get um syntax highlighting for these things because it's considered a singleton so it doesn't have that information but from here if you hit play what's gonna happen if i put a breakpoint here if you go ahead and hit play you click this it's going to break here and if i scroll this down you'll see that it passes without doing anything okay so it doesn't do anything the reason why is because the engine doesn't have that singleton loaded you actually have to go into android to click the button to do what you want it to do so what you need to do is you need to go to export export project and make sure again that you have this plug-in enabled if you don't have this plug-in enabled it will not work so export project we will export out our demo project with custom build and you'll see that it's going to go ahead and load all of that stuff okay so now that's done what we can do is we can click on our start menu go to android studio and we will go ahead and file profiler debug and we're going to double click our thing we're going to just say create new and update existing if we can let's see if it go ahead and let's us do that all right so now if we hit play and remember if you haven't set this up you gotta uh you see here this comes up we get a little button and if we click on it we'll wait a few seconds and there's our notification now it looks like i got these flipped uh test body over tests so it's actually this is test body and this is test my apologies first param is body second is title so as you can see that's about it um we went ahead and talked about how to do a custom android build we talked about native lib we talked about how to add a android notification how to call it via a button and again that can be done just about anywhere in your code i just used a button to make it easier for me to show off to you guys um we talked about how to use an android emulator a little bit and we talked about making sure that your plug-in is enabled when you're doing your builds so thank you guys so much again for watching and if you like this video hit the like button if you dislike it go ahead and hit the dislike button because again i am here to make content for you guys and i want to make stuff that you guys enjoy so thank you again and i'll see you all next time thanks you
Info
Channel: FinePointCGI
Views: 1,380
Rating: undefined out of 5
Keywords: godot, godot engine, godot android, godot tutorial, godot android tutorial, godot how to android, godot game engine, godot how to export to android, godot engine android tutorial, godot tutorial android, godot to android, godot android app, godot android game tutorial, how to export your godot game to android, export godot to android, Advanced Showing Local Android Notifications With Godot 3.2, android notifications, notifications, godot android notifications
Id: dL4sEMnvgsc
Channel Id: undefined
Length: 14min 33sec (873 seconds)
Published: Mon Jan 11 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.