Make Money Online BANNERS AdMob Android Tutorial 2021- 03 – Implementing Adaptive banner ads

AdMob Android Tutorial 2021- 03 – Implementing Adaptive banner ads

AdMob Android Tutorial  2021- 03 – Implementing Adaptive banner ads post thumbnail image


AdMob Android Tutorial
In this article we will be discussing AdMob Android and how to integrate it into your android app to display banner ads. AdMob is a mobile advertising platform that allows you to monetize your android app by displaying ads from Google ad network. It is very easy to set up and use AdMob in your android app. Let’s get started!

What is AdMob?
AdMob is a mobile advertising platform that allows you to monetize your android app by displaying ads from Google ad network. It is very easy to set up and use AdMob in your android app. You can display banner, interstitial, or video ads from Google ad network to earn revenue from your app.

Why use AdMob?
There are many reasons why you should use AdMob in your android app. AdMob is a reliable and trusted source of revenue for many developers. It is easy to set up and use. You can start earning money from your app almost immediately after setting up AdMob. Moreover, AdMob provides high fill rates and eCPMs (effective cost per thousand impressions) which means you can earn more money from your app with Admob than with other ad networks.

How does Admob work?
When a user clicks on an ad in your app, you will earn money from the advertiser. The amount of money you earn depends on the CPC (cost per click) of the advertiser. CPC varies depending on the type of product or service being advertised and the country where the ad is being displayed. For example, advertisers in US tend to have higher CPC than those in other countries.

How to set up Admob?
Setting up Admob is very easy and only takes a few minutes. First, sign up for an Admob account and create a new ad unit. Choose either banner or interstitial ad format. Banner ads are small rectangular ads that are displayed at the top or bottom of the screen while interstitial ads are full-screen ads that are displayed at natural transition points in your app such as between levels in a game or after completing an action such as making a purchase.
Next, generate an ad unit ID for your new ad unit which uniquely identifies it within your account. You will need this ID when integrating Admob into your app code. Finally, select one or more ad sizes for your banner or interstitial ads .Admob will automatically resize your ads to fit any screen size so you don’t need worry about creating different sized ads for different devices. That’s it! You have successfully set up Admob account and created an ad unit ready to display ads in your android app.

How to integrate Admob into Android App?
Integrating admob into Android App requires few lines of code changes which we will discuss next . Open build gradle file present inside /app directory in project explorer and add below line in dependencies{ …} compile ‘com:google .android .gms : play-services-ads: 11 .0 . 4 ‘}Sync project with gradle files by clicking on Sync Now button present at top right corner of android studio.. Add below line of code inside tag in AndroidManifest .xmlfile < uses-permission android:name="android .permission .INTERNET "/> This permission is required by admob sdk for serving ads.. Open activity_main .xml file present inside /res/layout directory , add below line of xml code inside RelativeLayout . This will add a textview with id tv_banner_ad which we will use later for displaying banner ad < TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/tv_banner _ad"/> Open MainActivity .java file , import below classes import com .google .android .gms .ads .AdRequest ;import com .google import com3import com4Open MainActivity java file , import below classes AdsActivity ; Ads Baseline ; AdsInterstitial ;Add below code snippet inside onCreate() method just before setContentView(R tvBannerAd = (TextView) findViewById(R if (getIntent().getExtras() != null) { // if we are coming from interstitial page if (getIntent().getExtras().containsKey(“source”) && getIntent().getExtras().getString(“source”).equals(“interstitial”)) { showInterstitial(); } else { loadBannerAd(); } } else { loadBannerAd(); }}This code snippet will check if we are coming from Interstitial page then it will showInterstitial() else it will loadBannerAd()… Add following methods just after onCreate()method private void loadBannerAd() { // Create an ad request using provided id String testDeviceId = “YOUR _DEVICE _ID”; // Load a Banner Advertisement advertisement = findViewById(R advertisementRequest = new advertisementRequestBuilder().addTestDevice(testDeviceId).build(); advertisementLoadCallback = new advertisementLoadCallback(){ @Override public void onResponse(@NonNull Response response) { super

Related Post