‫What's up guys and welcome to Master Coding Channel.
‫In this tutorial we will start the AdMob series so with the next tutorials would be about integrating
‫AdMob in different ways.
‫So we will learn about the interstitials, we will learn about banners and we will add the new forms
‫of ads inside our applications and inside the news, inside the recyclerview, inside the banners,
‫interstitials, video rewards and so on.
‫So welcome to this course.
‫In order to first we will need to integrate AdMob.
‫In order to integrate it, I will create now a new project, new empty project inside Android studio
‫just for demonstration and I will name it as AdMob app.
‫Okay.
‫As I told you, you can download our source codes from the resources folder on our Udemy course.
‫Okay.
‫We go to AdMob so search for AdMob on.
‫Google and we go to the site admob.google.com/home.
‫Home.
‫Get started.
‫And sign in with your account.
‫Okay, so.
‫After successful sign in.
‫We have this dashboard.
‫Okay, so click next.
‫Next.
‫And.
‫Decide later.
‫Okay.
‫We will go to the apps.
‫I will.
‫I will create an ad app.
‫Okay.
‫So we need to add our application.
‫Let me.
‫Copy the package name here.
‫Copy.
‫And we are going to set up the new application.
‫We select our platform, which is Android and is the App Store is listed on and support app play store.
‫It is no no for for our current application because this row and we didn't publish it on the play store
‫click on continue.
‫The platform app name with AdMob.
‫App.
‫And click on Add application.
‫Okay.
‫So this is.
‫Our application has been successfully added and an ad unit is placed in your app To run application,
‫we need to add a create and ad unit.
‫So click on create an ad unit.
‫We have diversity of, of uh, of these.
‫Ads.
‫So we have the banner, which is a rectangular ad that occupies a portion of application layout, interstitial
‫full page ad format that appears at natural breaks and transitions rewards, interstitial full page
‫ad format that rewards users for viewing ads during natural breaks or transitions and rewarded.
‫We have the full page ad format as before, and the native advanced customizable customizable ad format
‫that matches the look, look and feel of your application appears in line with app content.
‫We will see it in our news application that we have created in the previous course.
‫So we will add this, this functionality and this ad format in the previously created the application,
‫which is a news app that fetches data from WordPress and these are app open.
‫It is a beta and ad format that appears when the user open or switch back to your application ad overlays
‫Loading screen.
‫These are the interstitial and app open our beta.
‫So in our course we will learn about banner, the interstitial and the native advanced, which is embed
‫your ads inside a recyclerview so it will acts and feels like a naturally integrated and organic integrated
‫of native ads.
‫We will start in this tutorial by making the banner and I will create the ad name I will create as banner
‫ads 2021.
‫Okay, Advanced settings don't make anything for this because it will have the text and the view and
‫the video and Google optimized, which is highly recommended.
‫And the I don't prefer making eac-pm floor.
‫I will create the the ad now we have like these numbers.
‫So what are these numbers guys there is that an app ID and we have also the ad unit ID so when you see
‫like this dash, like this symbol, this indicates that app ID so complete the instruction in Google
‫map, Google mobile ads SDK guide using this app ID.
‫So we click on this.
‫And open in new tab.
‫So we have two steps here, the one for app ID, the second for ad unit ID, and the later on we will
‫review the policy.
‫But it is not
‫mandatory for this.
‫Now let's concentrate on our ads.
‫I'd.
‫App Unit.
‫App ID.
‫So remember, we are working now with the app ID.
‫I'm demonstrating with full details because we need to repeat these steps in the in the interstitial
‫ads and the advanced native ads.
‫So concentrate with me this video and later on we will work more and more faster in the next tutorial.
‫So we have here.
‫Due to integrate the Google at the project level dot gradle.
‫So I will go to the gradle scripts in our.
‫Application.
‫I will see that Google has been integrated naturally.
‫Okay.
‫And I need to add the implementation of Google Play services.
‫Okay.
‫I will copy it and I will go to the gradle dot build and below here.
‫I will paste it as here.
‫So this is for ads.
‫Ads.
‫Library.
‫Oh, okay.
‫So the implementation Google dot GM's play the services ads 19.7.
‫This is the latest version at the date of making this video.
‫Okay.
‫Update your android manifest.
‫Add your AdMob app ID.
‫It's very important, guys.
‫This is this step will make sure that your app is verified and it is working fine.
‫And the source of the banners and the source of ads are from your app.
‫So.
‫I will add the metadata for in our application manifest.
‫I will copy this.
‫Okay, I will copy this and I will go to the.
‫At first I will sink the project.
‫Okay.
‫Waiting for the services.
‫And I will go to the manifest inside the manifest.
‫I make.
‫I have copied this.
‫Okay.
‫So I will go inside the application tags.
‫I can paste this metadata whenever I want.
‫So as I told you, I will copy this and this is the application metadata.
‫I can paste it anywhere inside this.
‫So under the activity, the main activity, I will copy and paste it.
‫I prefer using this because I cannot I, I would not interfere with the application tags.
‫You can paste it here or you can paste it here.
‫So till now I advise you to paste it here.
‫If you see guys that there is a name which is the application ID and it is constant, we cannot change
‫it and we have a value.
‫So the value has been marked with X's and y's.
‫So what we have what we need to do.
‫I hope you guess it.
‫So I will copy this.
‫Application ID and I will paste it in the inside the value.
‫So.
‫I will paste it.
‫And you are now ready to tell Google ad services that, hey, Google, I am the ads that the user has
‫been clicked or has been viewed are from my application.
‫Okay, so this is for our manifest.
‫I will click on sync now also.
‫And we have integrated the app.
‫The app ID successfully.
‫Okay.
‫It's very important.
‫Now I need to initialize the mobile ads as the key.
‫How to do that Inside the Oncreate view, I need to copy the mobile ads dot initialize.
‫So.
‫I will copy this.
‫And I will go to the main activity where I need to display the mobile ads and I will paste this code
‫so the mobile ads dot initialize and having this listener.
‫So first of all, I need to click on Alt plus enter import class.
‫I see that Android studio has imported the mobile ads package.
‫Okay.
‫I need also to import the own initialization complete listener alt plus insert enter, click enter and
‫there is an implementation and importing of this package.
‫Also, I need to implement this import class and here we go.
‫We have imported the mobile ads initialization status and on initialization complete listener as this
‫indicates the three components that we have integrated.
‫Okay and import.
‫Now you can implement your type of banner.
‫Okay.
‫Again, guys, we have completed the part that it is very important and it is done once inside our application.
‫It despite how many ads you are displaying, how many ads, formats you have displayed.
‫So think of this as a general and a source, and it is a like a reference for app reference for Google
‫that telling him where and where is the ads displayed and and from where from which app.
‫This app, this banners are being displayed or interstitial or whatever you the type of the banner.
‫So it's very important to concentrate with me in making this application ID step.
‫Now we go to the second step, which is implementing the type of the banner for this video.
‫I have created an ad unit, which is the banner, which is the banner, and we need to implement this
‫banner in our application.
‫Okay, We have the ad unit ID, this is the app, this is the ad unit ID, This refers for the banners.
‫So guys, don't be confused.
‫This is for the app ID we have integrated successfully and we have initialized the mobile ads and we
‫have added to the manifest.
‫And the second thing we need to implement the type of the banner you need, the the type of the ads
‫which is banner interstitial rewarded videos and advanced native and so on.
‫We have see the six types of of ad formats.
‫Okay.
‫So the second step is making this implementation.
‫We have created the banner, which is and here we have the ID of this ad unit.
‫So I will select on the implement a banner and we get the.
‫The the instructions for the it, first of all.
‫We have imported the mobile SDK.
‫Ads SDK.
‫Okay.
‫And we have to add ad view to the layout.
‫So I will copy this ad view copy and we go to the to the activity that we have and we need to view the
‫ad and we go to the code under here, underneath the text view, I will paste it.
‫So it will be displayed like this.
‫I will add the constraints.
‫I will add it to the button.
‫Okay.
‫I will remove this and give it the.
‫Banner for this, So.
‫I will change this.
‫Hello?
‫And.
‫AdMob.
‫From Master Coding channel.
‫Text size.
‫I'll make it as 36.
‫Okay.
‫And.
‫Gravity center.
‫It will look like.
‫A professional and $1 billion application.
‫So it's it's funny that you need to make ads and you make applications and these simple things may lead
‫you and may give you the opportunity to to make complex applications and money and make money from them.
‫If you if you follow your passion, if you follow your advanced thinking and work exactly on your goals.
‫So.
‫Back to the earth.
‫I have to to add the ad unit ID and the ad size.
‫There is a very important step here.
‫You see, guys, we have two numbers here.
‫We have learned before what is and we have the ad unit ID, I will copy it.
‫Since the ID, since we the ID of ad unit ID is banner.
‫So we have this number for just the banners.
‫So I need to create the correct ad unit and I will give it the, the ID, the correct ID.
‫You see guys, that when you copy this, there is a default one that the that Google has been displayed
‫for you.
‫So if you run the application, there is a demo, a demo, a demo ad that will be displayed before we
‫paste here.
‫I.
‫We should make this step to paste our ad unit.
‫But before I will show you what I am doing or why I meant by this.
‫I will copy the code.
‫Here.
‫Okay.
‫I will copy this.
‫Sorry I copied this.
‫And we go to the main activity.
‫And underneath the the mobile ads that we have displayed, I will create here private.
‫Add the view.
‫My adview and it is done ad request and I will import the the package.
‫Okay.
‫I will I will make sure that I have reported the correct ones.
‫Okay.
‫I have imported the correct one.
‫Okay.
‫Guys.
‫Remember, I have I didn't I'm I did not paste our own application or add unit number which is ending
‫by 800.
‫It is the default one for the Google ending by triple ones.
‫I will run our application and show you what what will happen and what the results of our integration.
‫So after launching our application successfully, we have this thing.
‫This is a 468 times 60 test ad, so nice job.
‫This is a test ad that you have successfully imported and you are ready to display your own ads.
‫Okay.
‫So this is a message from Google.
‫Making you a nice job.
‫Telling you that it is a nice job to implement the AdMob successfully and the last step is copying the
‫ad unit ID and pasting it here, replacing the default one.
‫And we run our application.
‫Remember, guys, it will may not be displayed as first thing or it may be not displayed
‫directly because AdMob ad units creating AdMob units may take longer time for making for for displaying
‫real ads.
‫Maybe one day, two days, three days, four hours.
‫It depends, guys, but this is the correct implementation of ad units inside the application.
‫So the next step we are going to implement the interstitials banner interstitial ads, and then we are
‫going to implement the rewarded rewarded videos and the advanced native.
‫At.
‫So thank you guys.
‫I hope you subscribe to our YouTube channel.
‫Rate us five stars on Udemy and download our application master coding from playstore and join the millions
‫of people and coders who learn every day from our application.
‫Thank you guys.
‫See you in next videos.