 Hello and welcome today. We're going to take a game that we create in Godot and make it the launcher for our Android device. Why would you want to do this? Okay, so when I first started looking into doing this, I Googled it and I found people asking how to do it and a lot of the responses were just rude. Why would you do that? You can't do that. Well, you can and there are reasons to do it. So why would you want to do it? Well, if you have some sort of kiosk and you create an application in Godot and you have an Android device and it's a kiosk and you want that to be the main window, the main thing that pops up when the device starts, you want to make it the launcher. And a good example of this is if you have an arcade that you built, which I have a mini arcade cabinet that I built that I put an Android tablet in and I've thought about making even smaller ones and putting phones in there. And so that's what we're going to do today. We're going to take the Godot game that I've created and I'm going to make it the launcher, so the home screen for my Android device. Real quick, let's pop into Godot over here and you can see if I go to project export and I choose my Android export, I am going to look down here at the bottom of all the options and you can see there's a lot of things you can check for permissions for Android, whether it can access the internet, whether it can send and receive SMS messages, whether it can change your wallpapers, use near field communications, whole bunch of stuff and I've looked through here and maybe I'm just missing it because there's no way to filter this list and there's a lot of things in the list but I've looked for things that say launcher or home screen and you would think you'd be able to check that and it would add it. If it's in there and I'm missing it, let me know. But what we're going to do today is take an APK, I'm not going to go through creating it in Godot because creating an APK in Godot is a whole nother tutorial but I'm going to take that APK and you can do this with most APKs and we're going to decode it, decompile it, I don't think decompile it, decompress it and then we're going to make a simple modification to it and then recompress it. There'll be notes in the description, I'm going to go through this kind of quick but there's notes in the description that you can copy and paste this exact code and things do change a lot with Android. The way I did this a year or two ago has changed a little bit because Google is constantly changing how Android works but let's go ahead and hop in. So on the right side of the screen here is my phone and if I look at the applications you can see I have space attack installed on here so I can click on it and play it like any other application, play and then shoot stuff and I'm going to now exit out of the game but I want it so that again, when the device starts up or anytime this home screen button is clicked it goes into that game. So the first thing I need to do is uninstall it because we're going to end up re-signing this package and if you re-sign it with a different key it's not going to let you install over the old one so just uninstall it. Now on the left side here I have a directory where I've exported the APK to from Godot so again I can take this, I can install it to the device and it'll run just like it did but we want to use a tool called APK tool to decode it to decompress it because an APK is basically a zip file with a certain file structure, a manifest file and then it's signed and has certain headers to it. So what we first want to do is we want to pseudo-apt on a Debian based system and we want to pseudo-apt install APK signer, zip align, APK tool. We'll run that, I've already got these installed so we'll just let that do its thing or I'll just excite that but you'll want to install those. Now I am not going to use the APK from my repositories but I am installing it there. I'm going to pull the most recent one down from their GitHub page just to make sure I have the newest version because again, Android is constantly changing you want to make sure you have the newest version but installing it from here, make sure that you have all the dependencies installed and that's just what has worked for me. Let me move the Android device out of the way for a moment and so now that I have that you can go to their GitHub page. I am just going to, I already have a link to the most recent one, I'm just going to download it to the current directory and there we go. So now if I list out, I've got my original APK that I exported from Godot and this new jar file which is a Java file and what I'm going to do is I'm going to run that on the APK. So I am going to use Java, I'm going to do dash jar, I'm going to give it the file name that I just downloaded. We're going to say D for again, I don't know if it stands for decompress, decompile, decode, we're not really decompiling anything because also be aware that you can't do this with, if you pull down an APK that someone else created you may be able to pull it apart a little bit but there's going to be a biners that they might have stuff encrypted so you're not going to be able to change everything but this is something we've created. So again, we're going to run this command to decode it or decompress this APK. When we do that, it will take a moment and what's going to do is going to create a directory with the name of the APK. So it's just going to be in this case, space underscore attack and that's going to have our project files in it. So as long as you didn't get any errors, we list out, we can see that we now have a directory called space attack. I can list out what's in there and you can see some of the files. So I can go in here and I can like change the icons for this program. I can also go into the manifest and maybe change the name of the program, maybe some of the other resources if there's images and stuff. Obviously again, if there's certain binary stuff or if the creator of the APK encrypted things, you're going to be limited but not to worry for what we're doing. We're just going to use a text editor. I'm going to use Vim. I'm going to edit the Android manifest file. And this is just like basically settings for the application telling it certain things. We're going to come down to this intent filter and in here I am going to add two lines. I am going to add this one that says Android intent category home and Android intent category default. I am now going to say this. And again, those are in the notes in the description of the video. Now that I've done that, I can now build a new APK. So again, we're going to use Java dash jar, the AP or the app tool that we downloaded dash B for build and the directory of our build files. And it'll take a moment to do that. Once it's done that, it's going to create an APK. The last line of the output should tell us where the APK is stored. And then what we need to do is align the APK. This is a step that I didn't used to have to do but now I have to. But that's what the align tool is for. Building the APK, let's go ahead and let that finish. Give it a moment. Copying it to a directory. Okay, there it is. It's in space tech distribution, space tech dot APK. Let's go ahead and clear all of this. And now we're going to run this command. Zip align dash F dash P four. And then the APK that we just created and then the output for new APK, which I'm going to call SA just so I don't get confused with the original. So I'll run that. And if I list out files in my current directory, again, we have our APK tool. We have our original APK, the decompressed directory. And then we have the APK we just created. Now we can't just install that Android devices won't let you install it unless you sign it somehow. So this is where key tool comes into play. So we are going to now say key tool. We're going to generate a key. And again, if you're going to be trying to put this up on the Google Play Store, you're going to have to use a certain key with certain settings. And you're going to have to use the same key and not lose it because you can't make modifications in the app store if you don't have the original key. But we're not worried about that. We're doing this for personal use for again, kiosks that we're creating. So we're going to go tool gen again, this whole command is in the links in the description. So just run that. It's basically going to create a file called release.keystore. You can call it something else if you'd like. We're going to head and run that. You need to create a password. I think it's got to be at least six characters. And then confirm it. And now it's going to ask you a bunch of stuff. And again, if you're actually making a release, you're going to want to put this information. I'm just going to leave it all blank. And then when we get down here, is this correct? I'm just going to say why for yes. And now if I clear things out and list files, I now have that APK, but it's signed. Okay. Or I'm sorry, it's not signed yet. We created the key, but now we want to attach that key to it. We're going to use app signer, our APK signer dash sign dash dash KS, the name of the file where we put our key and the APK we want to sign. Again, it's going to ask you for the password you entered when you created the key. So go ahead and type that in. Don't forget that. Cause if you forget that, you can't resign it. Again, that's if you're putting it in app store. And that's it now. Let me go ahead and bring back my Android device over here. You can see a space attack is not installed. So I'm just going to do ADB. You can send this to a device. I'm assuming that if you're watching this video, you know how to install APKs. You can either copy it to the device and install it on the device. I'm just using Android debugging bridge. I'm going to ADB install that file through USB. And there it is. So again, I can click on this and run it just like I always have, right? And it runs and I can play the game. But if I now go to my settings. So let's go ahead and go to settings. And there's a few different ways you can do this. I'm going to go to apps. And I can click on it here. If you don't see the app that you just installed there, go to see all apps. I'm going to scroll down to that app, click on it. And because we added those lines, we now have an option. You may have to click on advanced to see this option, but somewhere in here. Oh, I hope you caught my mistake because I just realized I made a mistake. I'm going to uninstall this. So that was me showing you that the option wasn't there. I'm going to uninstall that. It's uninstalled. I installed the original APK. I need to ADB install the SA APK that I created. So now that I have that, I can look. And again, I can click on it and run it like a regular application. But if I was to go into settings and go to apps and choose that application, I can now scroll down and you can see there's a home app option because of those two lines we added to the manifest file. And again, this sometimes you might have to click on advanced options for this show. Just depends on your device. I'll click on that. You can see my default is Trebuchet, Trebuchet. And then I'm going to click on this and that makes this my home application. So you can see it opens up. I can click exit. Now, anytime I click home, it will instead of going to the other launcher, it will open up this game. When I start up the device, that'll be the default that it starts up to. If I was to click this and clear these and click here, it's going to open up that. So that is now the home screen of my device. And so if I wanted to make an arcade out of an Android tablet or mini one out of a phone or if I wanna make some sort of kiosk application, this is now the default. When you turn on the device, when you hit that home button, it's going to go to our application. So that is how you make a launcher for an Android device using Godot. There may be another way, but that's how I do it. Again, look at the links in the description of this video. And yeah, in general, if you're trying to make a real launcher that actually acts like a launcher for a regular Android device, Godot probably is not the best option. But again, if you're trying to make a kiosk or some sort of arcade where it's just, you have one application that's the main application. This is how you would go about doing that. Let me know what you think about this. Do you know a better way? Is there an option in the Godot export options that I'm not seeing that will circumvent all this so I don't have to go through these steps? But it's also this is a good tutorial on just using APK tools, which is useful if you want to make some modifications to an APK. Again, sometimes you're limited on what you can do. It all depends on who created the APK and how much effort they went into preventing people from making changes. You can also, with Godot, I know you can export an Android project and then make modifications and then compress it. We're basically just doing that in a roundabout way. Filmsbychrist.com, that's Chris with the K. There's a link in the description. Check it out. I have lots of videos there. I hope you found this useful and let me know if you create yourself a little kiosk arcade application. Have a great day.