Getting Started
Installation
Go to the AdMob portal and add your app (if you haven't done so already).
So you have the Application ID to follow the installation guide to add the plugin.
Initialize AdMob SDK
The plugin does not initialize AdMob SDK automatically. This allows requesting user consent before contacting any AdMob services.
Therefore, admob.start()
must be called before loading ads.
Note that admob
is undefined
until deviceready
event is fired.
document.addEventListener('deviceready', async () => {
await admob.start()
// Load ads here
}, false)
Create Ad Unit
Go to the AdMob portal and create a new ad unit for your app.
So you have the Ad Unit ID for later showing the ad.
Display Ads
Following the guide of different supported ad types to display ads,
ca-app-pub-xxx/yyy
should be replaced with your Ad Unit ID.