mymemotips

☰ Menu
  • Home
  • Articles
  • Android
  • Java 4 Beginner
  • Java 4 Ad
  • C#
  • Ubuntu tips

POPULAR POSTS

  • VMware Workstation 12, 11, 10 and 9 Unlocker to Run Mac OS X Guests on Windows 10, 8.1 and 7
    VMware Workstation 12, 11, 10 and 9 Unlocker to Run Mac OS X Guests on Windows 10, 8.1 and 7
    I find along time with mac OSX Yosemite VMware iso image in this post I will to discus with this poasted.On the off chance that you are a Ha...
  • How to install genymotion in Ubuntu Zesty 17.04
    How to install genymotion in Ubuntu Zesty 17.04
    In this post we will talking about how to install Genymotion emulate phone.Many asked us for installation instructions for installing Genymo...
  • Download Khmer Unicode for Windows and Mac OSX (Apple Computer)
    Download Khmer Unicode for Windows and Mac OSX (Apple Computer)
     Khmer Unicode is used everywhere nowaday even in government, companies, schools, and individule for making official documents or unofficial...
  • Create local chatroom with java using socket
    Create local chatroom with java using socket
    Hello every one in this video I will show you how to create local chat room in java. In this article I used socket by create socket object. ...
  • How to make Ubuntu look like mac OS X
    How to make Ubuntu look like mac OS X
    In this posted we will talking about how to customize Ubuntu 17.10 look like Mac OSX. I'm really tired to boot new OSX to my computer be...
  • Useful Windows 10 Shortcuts You Should Be Using
    Useful Windows 10 Shortcuts You Should Be Using
    The best way to use a Windows laptop or PC is through the various keyboard shortcuts. In this video, we show you 10 useful Windows shortcuts...
  • Best Windows 11 live wallpapers and animated wallpapers
    Best Windows 11 live wallpapers and animated wallpapers
     Customizing your desktop background is one of the most common tasks for personalizing your computer in your daily life. If you're tired...
  • Windows 10 Activator update 2022
    Windows 10 Activator update 2022
     Windows 10 Activator Txt is a text-based free Windows initiation technique. Here we will direct you through the Windows 10 Pro initiation p...
  • How to Add a Google Sitemap to your Blogger Blog
    How to Add a Google Sitemap to your Blogger Blog
    I'm really tired how to generate sitemap for blogger I try to research more about this. I found the solution to use xml sitemap is sort ...
  • Top 7 new features included in Windows 11
    Top 7 new features included in Windows 11
     This month, Microsoft released Windows 11, bringing significant changes to the storied operating system, including the first name change in...

NEW! CONTROVERSIAL Software Exploits $12.3 MILLION LOOPHOLE & Makes Us $519/DAY....

Cloud Tag

  • Access 2
  • Android 3
  • ArticleDotNet 2
  • Articles 15
  • Genymotion 1
  • Java 1
  • Python 1
  • Software 3
  • Ubuntu 3
  • Windows 4
Home Android Articles Integrating Google Admob Banner and Interstitial ads With Eclipse ADT

Integrating Google Admob Banner and Interstitial ads With Eclipse ADT

August 05, 2018
In this post we will talking about how to integrate AdMob in Android application with banner using Eclipse. with our example we will add admob banner on the top of our application by using ads test unite id, we will complete run this example so now let's start with eclipse IDE and following step by step :

Before we create project in eclipse we need to sign in your Admob account and create unite ads as banner. (ca-app-pub-6593689845821813/9312087245)

Get Google-Play-Service library 

make sure your Android SDK(System Development Kite) has been installed google play service in android manage. Open your eclipse tool and go to
1-  Windows  > Android SDK Manage


2- After completed install the project will download in to C:\Users\<User Name>\android-sdks\extras\google\google_play_services\libproject for Windows OS.

3- Import File>Import browse to  google play-service in extra folder  to your project work space follow with this :



Click Next it will popup like :


it will show google-play-service project folder in your current project work space. and next step we need to add google-play-service to our library follow this step: 

4- Right click on your Project go to Property of your project 


By Click Add button it will show 



Then click OK>Apply>OK

Now we go to our project in activity main.xml I create ads and assign id call @+id/adsview1

<com.google.android.gms.ads.AdView
   android:id="@+id/adsview1"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:layout_centerHorizontal="true"
   android:layout_alignParentBottom="true"
   ads:adSize="SMART_BANNER"
   ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView> 


AdMob provides test ad unit id for application development mode. After development we need to use actual ad unit id for your application.
Now we add banner UnitId in strings.xml


<string name="banner_ad_unit_id">ca-app-pub-3940256099942544/6300978111</string>
    
Android Manifest.xml add permissions meta data tag and Activity

Add Permissions 


<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 
    
Add meta data 

<meta-data android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" /> 
Add Activity Class


<activity android:name="com.google.android.gms.ads.AdActivity"
   android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
   android:theme="@android:style/Theme.Translucent" /> 
Full Android Manufest.xml



<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.grouprttcadmob"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        
        <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" />
    </application>

</manifest>

Now we back to our activity_main.xml in this code it very important to add the code like below in our layout

xmlns:ads="http://schemas.android.com/apk/res-auto
So you can put ads on you activity

<com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ads:adSize="BANNER"
        ads:adUnitId="@string/ads_banner_unitId" />

In MainActivity class


public class MainActivity extends Activity {
    Utility utility;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  setBodyText();
  utility = new Utility(this);
  utility.setLayoutForSmartBanner();
  //Display smart banner ads
                AdView mAdView = (AdView) findViewById(R.id.adView);
                AdRequest adRequest = new AdRequest.Builder().build();
                mAdView.loadAd(adRequest);
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
           getMenuInflater().inflate(R.menu.menu_main, menu);
           return true;
    }
}























  • Twitter
  • Facebook
  • Google
  • Tumblr
  • Pinterest

Related Posts

  • Enhanced TikTok Video Downloader with Stop, Pause, and Resume FunctionalityIntroductionIn today's digital landscape, TikTok has emerged as one of the most popular social media platforms, with users constantly ...
  • How to install genymotion in Ubuntu Zesty 17.04 In this post we will talking about how to install Genymotion emulate phone.Many asked us for installation instructions for installing ...
  • VMware Workstation 12, 11, 10 and 9 Unlocker to Run Mac OS X Guests on Windows 10, 8.1 and 7I find along time with mac OSX Yosemite VMware iso image in this post I will to discus with this poasted.On the off chance that you ar ...
  • Create local chatroom with java using socketHello every one in this video I will show you how to create local chat room in java. In this article I used socket by create socket ob ...
  • Google's Android Oreo Was Announced Sometime Back - What Sets It Apart From Its Predecessors?So you more likely than not began seeing Oreo in numerous gadgets as Google extends its rollout. The most famous gadgets to convey Ore ...
Next
« Prev Post
Previous
Next Post »

  • Sitemap
  • Privacy Policy
  • Contact Us
  • About Us
Copyright © 2016 mymemotips