90% Discount Hostinger Coupon 1CODERX53
896+ Capstone Project is Available: Whatsapp: +91-7011258995, Email: sharecodepoint@gmail.com

How to add admob ads in android app - Mobile app monetization the smart way

AdMob helps app developers monetize their mobile apps by showing ads in their mobile apps. - Admob.

How to generate Ads for Android apps !

How to monetize your android application using AdMob.

AdMob is a mobile ad network from google.

In this tutorial i will show you how to place AdMob simple banner ad in your android application.

What is Admob ?
adMob can be used for Android and iOS apps... Full Details


Step 1 : Add complie line to build.gradle
Go to > build.gradle (Module: app) 
compile 'com.google.firebase:firebase-ads:10.0.1' 

compile 'com.google.android.gms:play-services-ads:10.0.1'


Step 2 : Add string to string.xml
Even resource part-system glitch.
<string name="banner_ad_unit_id">ca-app-pub-3940256099942544/6300978111</string>

Step 3 : Add xmlns to main_activity.xml
xmlns:ads="http://schemas.android.com/apk/res-auto"
<com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    ads:adSize="BANNER"
    ads:adUnitId="ca-app-pub-3940256099942544/6300978111" >
    </com.google.android.gms.ads.AdView>

Step 4 : Import class into MainActivity.java
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;

AdView adView = (AdView) findViewById(R.id.adView);
        AdRequest adRequest = new AdRequest.Builder()
                .setRequestAgent("android_studio:ad_template").build();
        adView.loadAd(adRequest);

Step 5 : Add user permission to AndroidMainfest.xml
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

That's it! To place AdMob simple banner ad in your android application. Thanks for reading!

 If you have any doubt regarding the tutorial then leave your doubts in the comment box.

Sharecodepoint

Sharecodepoint is the junction where every essential thing is shared for college students in the well-defined packets of codes. We are focused on providing you the best material package like Question papers, MCQ'S, and one NIGHT STUDY MATERIAL. facebook twitter youtube instagram

Post a Comment

Previous Post Next Post

Contact Form