AdMob Settings

Contents

Make Money from Your Apps
4

The course is part of this learning path

Start course
Difficulty
Intermediate
Duration
55m
Students
20
Description

This course will show you how we can make money out of your apps. We'll explore the alternative ways to make money using IOS development as well as how to use Google advertisements in your app so that you can earn money with Google ads.

Intended Audience

This course is designed for anyone who wants to:

  • Learn about iOS development and coding
  • Move into a career as an iOS developer
  • Master Swift skills

Prerequisites

To get the most out of this course, you should have some basic knowledge of iOS.

Transcript

Hi. Within this lecture, we're going to see how we can create an advertisement account from Google and how we can integrate those SDKs into our project to show an ad to the user so that we can make money out of our apps. So, I'm going to create a new test project in order to do that. But of course, you can do that with your own projects. If you have a finished project that you want to bring an ad in, you can work on that as well. So, I'm going to name this GoogleAdMobTest and we're going to use this AdMob structure in order to show advertisements. So, let me create this project. And we're not going to do much in this project. In fact, we're only going to have only one button in which we will display some advertisements to the users when they click on the button to go into the next step or next View Controller or next level of a game, for example, they will see a full-screen screen size ad. So, that's what I'm going to do. I'm just going to bring in one button. I'm not going to make it so complicated because we're going to focus on advertisements and we have learned how to do other things like creating second screens and stuff. So, let me bring in this button and let me name the something like Next. So, let me make this a little bit bigger and put it in the center of the screen. And I'm going to name this Next and supposedly our user will just hit on this Next button to go into the next screen but I'm going to show them an ad first. So, let me open my View Controller, and let me bring in this next button. So, I'm going to call this nextClicked. So, that's where we are going to show our ads. So first of all, I don't need to do anything here because first of all, I need to bring in my SDKs and before we do that, we need to create an account so, let me go to Google and we're going to search for admob ios. So, AdMob iOS. This one. So if you hit Enter, you will see like a million results but we want the first one. So, this is what we want developers.google.com. So this is again, a service by Google and if somehow you end up in the first page of this Google AdMob, of course, you can click on IOS link to go into our iOS main page as well. And since Google is one of the biggest advertisers in the world, we will have no problem finding ads for our apps using this AdMob. So, that's why we are working with Google right now. And as you can see, if you're using Firebase, you have to use another SDK as instructed in here. So, Google actually owns Firebase and AdMob. So, the two services synchronize together very well. So, if you're working with Firebase, you have to work with another pod and 90% of what we're going to do is the same actually but rather than using the Google Mobile Ads SDK, you have to use Firebase AdMob SDK in order to reach the same solution. But in here, I'm just going to assume that you're not using Firebase in your app and I will show you how to work with Mobile Ads SDK. And after watching this section, you will be able to adjust it so that you can use it in your Firebase account as well, just following the instructions over here easily. So, come over here and as you can see, we have some prerequisites and it says that you have to create an AdMob account and register your app in order to start working. So, that's what we're going to do. So, let me open this Create an AdMob account link. And here, you will be asked some questions. So, it says that do you have an AdSense account or do you have an Google Ads account? So, I will assume you don't have any of those. So, we're going to start from scratch. And if you open this, it will give you a link called apps.admob.com and you have to go to that link and give your country, time zone, and preferred currency. So, let me open this link and it's very easy to sign up. Since I already have an account, it will open my account directly but you can just sign in with your Gmail account or Google account and if you don't have any Gmail account yet, please open one so that you can use it in Firebase and AdMob as well and then you can provide your country, time zone, and preferred currency so that you can create your AdMob account and you can start working on it. So, once you do that, it will bring you a page like this. As you can see, I have a test app installed in my AdMob and as you can see, my account is approved. So, if this is the first time that you're creating this account, they may ask some documentation to prove that you're really the person that you claim to be. After you do that, like if you provide your bank account details or if you provide your passport number or something, it will be approved so that you can start earning money out of Google. So, here we see the statistic of my app and as you can see, it doesn't make any money so I believe it's just failing over here but it's just a test app. So, what you want to do is to come over here and say Add a new app. Once you do that, it will ask you if you have already published your app and in my case, it's not published. So, I'm going to say NO.  If it's published, it will ask you for App Store Id or Google Play Id. So, my app name will be something like GoogleAppStoreTest or AddMobTest. So, I'm going to call this GoogleAdMobiOSTest and platform is iOS of course, and it will just create the app and it will give me something called App ID. So, this is what I need to make money. So, I need to use this in my code so that I can relate my ads with my own app. So, either take copy, take note of this or just copy it because we're going to use it later on. And if you say Create an Ad unit, it will give you some page to create ad units and this will give you some IDs to use in your app but I'm not going to do that now. If you click on it, it's very easy. You can just choose an Ad format and create it. We're going to see what our Ad formats and we're going to see how we can do that later on but right now, I just want to move forward because in order to do that I need to get the SDKs into my code project and start connecting my Xcode project with my AdMob account so that I can integrate all these apps into my app. So, let's close this down and my app is already installed over here. So, I can see the details and once I'm ready, I can come over here to create ad units. So, let's continue. As you can see, it asks us to bring in some parts so we know how this works.  We need to create a pod file and copy this into our pod file to install it. So, let's do that. In fact, let me close this down rather than minimizing it because we're going to work with our pod file and let me open my terminal and make this a little bit bigger. Since you know how this works, I'm going to be quick over here. You know how to work with terminal at this point, I believe. So, I'm going to go into my folder and it's in the iOS complete and it's in the GoogleAdMobTest. So once I'm over here, I can run part of it and it will create a pod file for me. So, let me go and find my pod file in my folders as well. So, let me come over here. That is the one. So, let me open this with Text Edit and here you go. Now, if I make this a little bit bigger, we can see it better. And under this used frameworks, I can just paste in what I have copied. So, let me save this and let me run pod install. So, this will create the pod for me. This will download the pod for me and integrate in my project. So, let me go back to documentation while it happens. And after we are done with our download process, we're going to have to take care of our info.plist as well in order to connect our project with our AdMob account. So, this is what we have to do. This is what we have to add to our info.plist and we're going to do it in the Source Code. So, we have to get our app ID from this Ad account as well in order to do that. So, let me see. It's downloaded. So, let me open my project over here. And since now, it's already integrated in my project. I'm going to go ahead to my info.plist and add this line into my info.plist. So, let me copy all of these things from here. And we haven't seen the change of the source code before. We have worked with regular info.plist way. But right now, we're going to change the source code. So, let me copy this and go back here and right click on my info.plist and say Source Code rather than Property List. So, here here you see the XML like representation of the info.plist rather than its regular representation. So, you can just paste this GAD can come over here to Property List and you can see this is integrated into my info.plist as it is. So, this is what we have to change really. So, let me come back to our settings. Not the actual settings. In fact, we have to go inside of the app. Rather than this Publisher ID, We want the ID of the app itself. So, let me go back to our home and inside of our app. And in the app, you have to find the settings of the app itself. So, here is our App ID. So, you can copy it from here and paste it in this info.plist file. But I'm not going to do that because if we do that, this ad won't show up. We can't test it because this App ID is only active once we install the app to the app store and even we have to wait 24 hours to be active. So, rather than using this App ID, I'm going to use the Test ID that is given to me over here so that I can test my ads. So, I'm going to copy this and I'm going to change it back to this original Test ID. But before uploading your app to the App Store, don't forget it because until you change it to your real App ID, you won't be able to connect your app to your real AdMob account. So, I'm just going to go with this test I. D. And then change it later on once I'm ready. So, let me stop here and within the next lecture, we're going to see how we can bring in the advertisements into our project as well.

 

About the Author
Students
1430
Courses
55
Learning Paths
3

Atil is an instructor at Bogazici University, where he graduated back in 2010. He is also co-founder of Academy Club, which provides training, and Pera Games, which operates in the mobile gaming industry.

Covered Topics