Get Started

Integrating the Google Mobile Ads SDK into an app is the first step toward displaying ads and earning revenue. Once you've integrated the SDK, you can choose an ad format (such as native or rewarded video) and follow the steps to implement it.

Before you begin

To prepare your app, complete the steps in the following sections.

App prerequisites

  • Use Android Studio 3.2 or higher
  • Make sure that your app's build file uses the following values:

    • A minSdkVersion of 16 or higher
    • A compileSdkVersion of 28 or higher

Configure your app

  1. In your project-level build.gradle file, include Google's Maven repository and Maven central repository in both your buildscript and allprojects sections:

    buildscript {
        repositories {
    allprojects {
        repositories {
  2. Add the dependencies for the Mobile Ads SDK to your module's app-level Gradle file, which is usually app/build.gradle:

    dependencies {
      implementation ''
  3. Add your Ad Manager app ID (identified in the Ad Manager UI) to your app's AndroidManifest.xml file. To do so, add a <meta-data> tag with android:name="". You can find your app ID in the Ad Manager UI. For android:value, insert your own Ad Manager app ID, surrounded by quotation marks.

            <!-- Sample Ad Manager app ID: ca-app-pub-3940256099942544~3347511713 -->

Initialize the Mobile Ads SDK

Before loading ads, have your app initialize the Mobile Ads SDK by calling MobileAds.initialize() which initializes the SDK and calls back a completion listener once initialization is complete (or after a 30-second timeout). This needs to be done only once, ideally at app launch.

Here's an example of how to call the initialize() method in an Activity:

Example MainActivity (excerpt)



public class MainActivity extends AppCompatActivity {
    protected void onCreate(Bundle savedInstanceState) {

        MobileAds.initialize(this, new OnInitializationCompleteListener() {
            public void onInitializationComplete(InitializationStatus initializationStatus) {



class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {

        MobileAds.initialize(this) {}

If you're using mediation, wait until the completion handler is called before loading ads, as this will ensure that all mediation adapters are initialized.

Select an ad format

The Mobile Ads SDK is now imported and you're ready to implement an ad. Ad Manager offers a number of different ad formats, so you can choose the one that best fits your app's user experience.

Rectangular ads that appear at the top or bottom of the device screen. Banner ads stay on screen while users are interacting with the app, and can refresh automatically after a certain period of time. If you're new to mobile advertising, they're a great place to start.

Implement banner ads


Full-screen ads that cover the interface of an app until closed by the user. They're best used at natural pauses in the flow of an app's execution, such as between levels of a game or just after a task is completed.

Implement interstitial ads


Customizable ads that match the look and feel of your app. You decide how and where they're placed, so the layout is more consistent with your app's design.

Google Ad Manager offers two ways to implement native ads: Native Styles and Custom Rendering.

Native Styles has been designed to make the implementation of native ads as easy as possible, and it's a great choice if you are new to the format. Custom Rendering has been designed to maximize the freedom you have in creating your presentations.

Implement native ads Implement native styles


Ads that reward users for watching short videos and interacting with playable ads and surveys. Used for monetizing free-to-play apps.

Implement rewarded ads

Additional resources

The Google Mobile Ads repository on GitHub demonstrates how to use the different ad formats that this API offers.