Updated on 10/9/2018 to fix the format of the AdMob application ID. The format of an AdMob app ID is ca-app-pub-##########. Google Mobile Ads SDK v17.0.0 for Android has just been released, and it comes with two important changes that you should be aware of. For the purposes of this codelab, you can use the sample App ID shown above. In a real app, you would Set up an app in AdMob and find your app ID in the AdMob UI. Initialize the SDK. Before loading ads, have your app initialize the Mobile Ads SDK by calling MobileAds.initialize with your AdMob App ID. This needs to be done only once, ideally. Make smarter decisions to grow mobile app earnings and improve customer experience. AdMob’s robust reporting and measurement features deliver deeper insights into how your users are interacting with your mobile app and ads. Gain even richer insights by directly integrating Google Analytics for Firebase with AdMob. See all of your revenue streams in one place, including advertising earnings and in-app purchase revenue. With Google Analytics for Firebase integration, AdMob automatically converts impression-level ad revenue into Lifetime Value and Average Revenue per User metrics, allowing you to build customized ad experiences for each of your audience segments and track value growth.
Integrating the Google Mobile Ads SDK into an app is the first step towarddisplaying ads and earning revenue. Once you've integrated the SDK, you canchoose an ad format (such as native or rewarded video) and follow the steps toimplement it.
Prerequisites
- Use Android Studio 3.2 or later
minSdkVersion
14 or latercompileSdkVersion
28 or later
Where can I download the Google Mobile Ads SDK? Learn more about the new AdMob rewarded ads To download the Google Mobile Ads SDK, click on one of the following links. Download the Mobile Ads Unity plugin. The Google Mobile Ads Unity plugin enables Unity developers to easily serve Google Mobile Ads on Android and iOS apps without having to write Java or Objective-C code. The plugin provides a C# interface for requesting ads that is used by C# scripts in your Unity project.
Import the Mobile Ads SDK
Note: You should begin with a new project in Android Studio and check thebox to Use AndroidX Artifacts or refer toMigrating to AndroidX tomigrate your project.
Apps can import the Google Mobile Ads SDK with a Gradledependency that points to Google's Maven repository. In order to use thatrepository, you need to reference it in the app's project-level
build.gradle
file. Open yours and look for an allprojects
section:Example project-level build.gradle (excerpt)
Add the
google()
directive above if it's not already present.Next, open the app-level
build.gradle
file for your app, and look fora 'dependencies' section.Example app-level build.gradle (excerpt)
Add the lines in bold above, which instruct Gradle to pull in the latestversion of the Mobile Ads SDK and additional related dependencies. Once that'sdone, save the file and perform a Gradle sync.
Update your AndroidManifest.xml
Declare that your app is an Ad Manager app by adding the following
Important: This step is required as of Google Mobile Ads SDK version 17.0.0.Failure to add this <meta-data>
tag in your AndroidManifest.xml.<meta-data>
tag results in a crash with the message:The Google Mobile Ads SDK was initialized incorrectly.
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, soyou can choose the one that best fits your app's user experience.
Banner
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 canrefresh automatically after a certain period of time. If you're new to mobileadvertising, they're a great place to start.
Interstitial
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 asbetween levels of a game or just after a task is completed.
Native
Customizable ads that match the look and feel of your app. You decide how andwhere 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 andCustom Rendering.
Native Styles has been designed to make the implementation of native ads as easyas possible, and it's a great choice if you are new to the format. CustomRendering has been designed to maximize the freedom you have in creating yourpresentations.
Rewarded
What Is Sdk For Android
Ads that reward users for watching short videos and interacting with playableads and surveys. Good for monetizing free-to-play users.