AdMob App Id and Ad Id for Android Monetization
While there are many providers of app monetization services, Google, the maker of Android, provides its own ad service, called AdMob. To use Google AdMob you will need a Publisher Id, which is created when you create your Admob account. Each app using AdMob will also require its unique AdMob app id, created when the app is registered with AdMob. Finally each ad slot in the app will require an ad unit id, which is created when an ad unit is defined for an app. Once these ids are defined the Google ads library can be added to the app project.
What is AdMob in Android?
When a device is running your ad enabled app you get a very small payment for each ad that is selected (clicked or pressed on), and a small payment for so many thousands of ad impressions (displayed ads). In order for Google to make that payment it must identify in which app the ad was placed. This is done by placing unique AdMob ids in the code that is showing the ads. To get the unique ids for each app and ad you need an AdMob account. Head over to Admob and sign up, you will need a Google account to register.
Once the AdMob account is created the Publisher Id can be found under Account Information from the Settings icon.
Add an App to Admob
In your AdMob account use the Apps icon to add you app. Click the icon and then select ADD APP.
Enter the App Details
Fill out the app name.
The App ID is then available to add to the app code and can be copied using the clipboard icon. It can also be retrieved from the apps list later if required.
If ready to create an ad unit use the Create Ad Unit button.
Create AdMob Ad Unit
Choose the ad type.
The ad unit is named for easy of reference in the performance reports.
The ad unit id is available for use in the app code. If it is not copied after the ad unit is created, then it can be copied from the Ad Units option under the app details later. Links are provided for help on adding the AdMob code to the app.
Accessing App Id and Ad Unit Id
Under the Apps list the clipboard icon can be used to copy the AdMob app id for a particular app.
Likewise the ad unit id can be copied under the ad units section for the registered app.
Using Test Ads
Prior to final app release the test ad ids should be used when testing code. If real ads are used during the testing phase Google may block the app from displaying ads due to excessive ad requests. See the Google Test Ads article for more information.
If you need to test the AdMob code without registering a new app with AdMob then use the test App Id listed on the Mobile Ads SDK Get Started page (at the time this tutorial was written the test app id was ca-app-pub-3940256099942544~3347511713
).
See Also
- AdMob developer documentation
- AdMob for Firebase Getting Started
- See the Tek Eye Android Studio example projects to learn Android app programming.
- For a full list of the articles on Tek Eye see the full site Index
Author:Daniel S. Fowler Published: