Saturday, 3 January 2015

Interstitial Ad in Android application.

Banners are small ads that when touched typically take the user to some form of full-screen in-app browsing experience.
Interstitials, on the other hand are  full page ad experience at natural transition points, such as a page change, an app launch, or a game level load. Interstitials use a close button that removes the ad from the user's experience. Ads are displayed in an iFrame that floats over the web page or app.
At the end of this tutorial you will able to display an full page ad as shown in the image
                         
Full page ad/Interstitial Ad

In the previous post we have seen 

a.)how to create an account in adMob 

b.) how to generate an adUnit Id.

c.)how to create an banner ad in your android application.

If you missed the previous post click here to visit the post as this post is continuation for how get live ad's in your android application.

Now in this post we will see how to display an Interstitial ad on load of an activity in our sample android application.

Step-1:

Login to your adMob account and click on Monitize tab you will see the list of apps on the left side of the page which you have created earlier  you can select any of those application or an new app.

 
step1(a).
As show in the image click on Interstitial tab and fill the required details once you submit you will see an Ad unit ID: ca-app-pub-xxxxxxxxxxx/xxxxxxxxx created.

Step-2:

refer Step:2 and Step:3 in this link. click here

Step-3:


Now add the lines highlighted in blue color in your Manifest.xml:
-------------------------------------------------------------------------------------------------------------

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
        
    //add the above two lines before <application> tag     

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        
        <activity
            android:name="com.google.android.gms.ads.AdActivity"
             android:configChanges="keyboard|keyboardHidden|orientation
             |screenLayout|uiMode|screenSize|smallestScreenSize"
            android:theme="@android:style/Theme.Translucent" />
        
        <activity
            android:name="com.example.demoad.activity.DemoActivity"
            android:label="@string/app_name" 
            android:configChanges="orientation|keyboardHidden|screenSize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

AdMob tutorial


In this tutorial, you will learn how to integrate the new Google Admob with banner and interstitial ads into your Android application. The new AdMob is a streamlined user interface, to make it even easier for you to monetize and promote your apps in minutes. Maximize your earnings with the new AdMob improved tools to help app developers build their business. We will create a simple app where we will have an banner ad and Interstitial ad.So lets begin…

So at end of this post you will find some live ad shown in your layout in the following picture.

If you're a developer and you're looking for a way to make money on your own app or game while still keeping it free, you can make decent money using the AdMob system.


            
Live Banner Ad.


Step 1:

Sign up as an Admob Publisher here. Log in to your dashboard once you have your account approved.

Once you have created your account you can find your publisher id at top right of your dashboard.


                       
Now click on  Monetize tab and create an ad unit for your application. You should be able to see your ad unit after selecting an app on your left panel.                                                             
step-1(a)
                                                       
step-1(b)


                             
step-1(c)