Sharecodepoint App Download Qrcode Sharecodepoint Android App Banner
Now You can search anything in sharecodepoint using your voice. Click on mic button. Sharecodepoint Voice Sharecodepoint Youtube Channel



Sharecodepoint popular queries

Saturday, 2 June 2018

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.

0 comments:

Post a Comment

 

Version 23.2.3.4 - 2016 - 2019 - © Sharecodepoint | Made in India. | Copyright Content