# Admob Configuration

## Introduction

[AdMob](https://developers.google.com/admob/) is a multi platform mobile ad network that allows you to monetize your android app. By integrating AdMob you can start earning right away. It is very useful particularly when you are publishing a free app and want to earn some money from it.

&#x20;Integrating AdMob is such an easy task that it takes not more than 5mins. In this article we’ll build a simple app with two screen to show the different types of ads that AdMob supports.

### Creating Ad Units

{% hint style="info" %}
NOTE : AdMob admin interface changes quite often. The below steps to create Ad Unit IDs might differ time to time.
{% endhint %}

Want to know more?? Follow this link - <https://developers.google.com/admob/android/quick-start>​

**1**. Sign into your [AdMob](https://apps.admob.com/) account.

**2**. Create a new App by giving the **package name** of the app you want to integrate AdMob. Once the App is created, you can find the **APP ID** on the dashboard which looks like **ca-app-pub-XXXXXXXXX\~XXXXXXXXX**.

**3**. Select the newly created App and click on **ADD AD UNIT** button to create a new ad unit.

**4**. Select the **ad format** and give the ad unit a name.

**5**. Once the ad unit is created, you can notice the **Ad unit ID** on the dashboard. An example of ad unit id look like **ca-app-pub-10XXXXXXXX/XXXXXXXXXXX**

![Create ad unit for banner ads](https://1775135344-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEJMOB9N9sZzzXDOTso%2F-LEJxo0dO2dejRuDhnsU%2F-LEK31t3YjYAmTOQS4dI%2FC_Users_itechnotion-Divya_AppData_Local_Packages_Microsoft.SkypeApp_kzf8qxf38zg5c_LocalState_f116bee6-d62c-4961-8de8-d37a0fda2e25.PNG?alt=media\&token=72fb174e-04e7-4442-83b2-dd0cfa0c9b80)

After creating banner ad unit and interstitial ad unit you have to place you adUnit id in string.xml file.

**app > res > values > string.xml**

![string.xml](https://1775135344-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEJMOB9N9sZzzXDOTso%2F-LEJxo0dO2dejRuDhnsU%2F-LEK3iJhTEOF7bt7A4Wc%2FC_Users_itechnotion-Divya_AppData_Local_Packages_Microsoft.SkypeApp_kzf8qxf38zg5c_LocalState_213e02f7-9903-4fd2-ad64-5757f204ad8a.PNG?alt=media\&token=d96f0895-885d-4d21-9a71-f845b6bdc09e)

## **How to remove AdMob Ads from App?**

#### Remove InterstitialAd

Go to **app > java > com.itechnotion.wpnews > Home > HomePageactivity**&#x20;

![HomepageActivity.java](https://1775135344-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEJMOB9N9sZzzXDOTso%2F-LIdSvqVJ-YlIeC7OBn1%2F-LIdVkI_dMYLTTtrKE-v%2FfullscreenAds.PNG?alt=media\&token=53a7eefe-e31b-4978-be60-0c26df95e335)

remove  below code

```
if (isAdd==true) {
    InterstitialAd();
}else {

}
```

#### Remove BannerAd

Go to **app > java > com.itechnotion.wpnews > Home > HomeFragment**

remove **Banner()** from onCreateView method.

![HomeFragment.java](https://1775135344-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEJMOB9N9sZzzXDOTso%2F-LIdSvqVJ-YlIeC7OBn1%2F-LIdWWTv2tX1OKW8besI%2Fhomebanner.PNG?alt=media\&token=a56b85d0-de3c-4f0d-a16d-bee466f4a4f8)

**app > java > com.itechnotion.wpnews > AlldataFragment**

remove  **Banner()** from Initialization method.

![AlldataFragment.java](https://1775135344-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEJMOB9N9sZzzXDOTso%2F-LIdSvqVJ-YlIeC7OBn1%2F-LIdXZSzDrLV7tiAEPs3%2Falldatabanner.PNG?alt=media\&token=d6d45406-64b4-4175-a6b5-81b4b5172c94)
