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, ads should be loaded or calling admob.start()
explicitly after consent is obstained.
Note that admob
is undefined
until deviceready
event is fired.
document.addEventListener('deviceready', async () => {
// Obtain user consent first
await admob.start() // or start loading ads
// 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.