Add Monetized Ads to Your App On Android with Admob

in #utopian-io6 years ago

Repository

Google Mobile Ads

What Will I Learn?

With my help, you will learn an easy, simple method to have a small extra income for our applications, games, etc. in portable devices as it is in this case the android cell phone, through the use of monetized ads that will be shown in those apps.

  • implement banners in your apps.

Difficulty

  • Intermediate

Requirements

Introduction

Most people who design apps, games or any program related to a mobile device, take the opportunity to add to their creations ads, something that many users who use the app / game hate, but why if most do not do you like them to appear, do they continue to place them? The answer is very simple: imagine your application / game as a football field (yes, why not use that reference?) These places allow you to enjoy, but also see different advertising that is placed throughout the place, the The stadium has the users, and said users learn about the products through the advertisements shown there; and as retribution to the stadium, those ads are paid for showing it to the public. A little orthodox is no explanation? In the case of applications it is like that, your apps / games have the public, what you do is to that audience to make known a product, place, et cetera; by showing ads in your apps they will pay you, as simple as that.

Then in addition to generating income with your app / game in integrated purchases you can have an additional income just showing ads (interesting, right?) And with this tutorial I will teach you to implement them in Unity very easily, thus achieving the use of banners and interstitials in Our App to generate income.

Unity is a video game engine, which through this platform programmers, like me, design different programs, most games which can be compiled in different platforms, be it PC, Android, IOS, WebGL, etc; You can even compile games for the platforms of PS4, Xbox and Nintendo (for this you must pay a license).

Admob is a Google advertising platform with the ability to help app developers to make money with them, as simple as that.

Once all this is defined, it is time to start with the tutorial of the implementation of Admob to our apps in Unity:

First of all, go through the requirements and download all the files that are needed, which will be the key to the successful achievement of this tutorial.

Before starting with the implementation of the ads we must configure our Unity for the Android platform, for this we must first have installed the SDK (Software Development Kit) and JDK (Java Development Kit) that are requested in the requirements, once installed, in our Unity we will create a new project, which we will configure as a 2D project (for greater ease for this tutorial).

Once the main window of our project is open, to configure Unity for the first time to work with the Android platform we must include the SDK and JDK to be able to choose this platform, for this it is very simple, we will go to Edit> Preferences. Unity will open a window with several preferences that it gives by default, we click on where External Tools says and there will be a part that says Android, it is simple, where it says SDK and JDK will do a search of the folders where those add-ons are obtained, once added to those preferences, we close Unity and reopen the project, we access back to Unity preferences and we should start compiling on Android!

Now we must select the platform in which the project is going to compile, this platform is that of Android (for this we did all these previous steps) we just go to File> Build Settings and in this window we will find the different platforms with Unity can work, we select Android and we have to press the button that says "Switch Platform" which will make our platform to compile Android. It should appear like the photo once the whole procedure is done.

If for some problem you have an error when compiling Android, I recommend that you see the YouTube channel of my good friend BTOUnit specifically this video that explains step by step, and carefully how to install and configure the SDK and JDK.

Well, then we have selected the platform to which we are going to compile, we must have our own account of Admob which we can associate with our Google account. Once we have created our Admob account (which is very simple) we will be in the main menu of this web page.

This is where the monetization of ads begins, as a first tutorial we will try to add banners to our Unity apps, for that we will click on applications and as it will be our first monetized app we will select "Add Your First App", here the formulation will begin to associate the app with the ads, a box will appear where it tells us if our app is published in Google Play / App Store, if it is published, it is enough to say yes and search our app in the search engine, otherwise, we select not and we put the name of our app and which platform is directed.

It will give us the congratulations for having added our APP to Admob, our next step will be "Create AD Unit" in which we will appear three ad options to add to the app, for now this tutorial will be done with banners, so we will select banners, we put a name to the banners (It is to be located in Admob) and select "Create Ad Unit" and we would already have the Admob part ready, it will generate a code by default, which we must save since that code will allow us to display banners in our app (It should be noted that the image shows two codes, the first is our editor code, the second is our banner code, we will save the second code, as the image shows).

Now is where the fun begins, we have our platform to compile, and we have our banner code to implement it in our ads, now we will return to Unity, in our project which was already open and we will proceed to import the last two files that were asked in the requirements of the tutorial, the plugins of GoogleMobileAds and EasyGoogleMobileAds to our Unity project, once here we would have all the necessary files to implement the ads to our App.

*Important: * When importing there can always be errors associated with missing a file, missing a script, and so on. Therefore, here is a plugin Unity is a folder with all those files plus the Android plugins (That again is often requested by our App), so my recommendation is that once you download the files, make the tutorial , and do not get them to work, they import this plugin to complete some files that were missing.

Now that we have all the files imported we will go to EasyGoogleMobileAds> Prefabs and we will drag the only prefab that is in that folder to "Hierarchy" that we put there is a prefab in order to be able to add banner without a single line of code.

Now it's very simple, in Inspector will be the information of the prefab, what we have to do is simple, we select our language (it is available between Spanish and English) and where it says Base Settings, just in the part of Ad Unit Id (Android) we have to paste our code that Admob generated us by default when creating the banner, below we can choose between the size of the banner, the position (Up, down, to the center) and, as it had placed in the requirements the optional part to download, if you want to test the ads, and so that Admob does not penalize you, makes your phone a testing device, I recommend it a lot.

Now what we have to do is save the project and import it to the Android platform to prove that what we did worked, what happens, Admob will only show ads on mobile devices / emulators, so do not be afraid if you try within the same Unity emulator the banner does not appear, otherwise, a message saying this will appear, which means that although the banner is not visible, it is being shown to the public and works perfectly.

Now that you have already exported to Android, and tested from your phone, it will look something like this:

Then it will be on your part to add or not monetized ads Unity apps, I hope you liked a lot this simple tutorial. Until next time in Steemit.

In the Next tutorial: Add Interstitials and Control when to make them appear and Disappear.

Curriculum

This is my first Tutorial.

Sort:  

Thank you for your contribution @anonym0us.
The following points are recommended below:

  • Include proof of work under the shape of a gist or your own github repository.

  • Avoid placing only application definitions in your tutorial.

  • There is a lot of information on this subject, try to find something more innovative and contribute to the open source community.

  • The utopian tutorials are specifically to be used in a technical way to help the open source community learn new content.

Please see this tutorial link which is a good example of a well-developed tutorial.

In your next tutorial we suggest you to be more technical so that it is useful for the entire open source community.
We are waiting for your next updated tutorial.

Please read the guidelines here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you for your review, @portugalcoin!

So far this week you've reviewed 7 contributions. Keep up the good work!

Why a tutorial for Unity only? How about Android Studio?

Admob supports Android studio, but this plugin it's for Unity, I'll soon publish one of android studio

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.034
BTC 63750.99
ETH 3130.22
USDT 1.00
SBD 3.95