Showing posts with label Interstitial Ad. Show all posts
Showing posts with label Interstitial Ad. Show all posts

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>