Skip to main content
Version: Next

Upgrade Guide

From V1 to V2

Kotlin Required

Kotlin support is required for V2, make sure your project is enabled it.

<platform name="android">
<preference name="GradlePluginKotlinEnabled" value="true" />

Ad id defaults to adUnitId

Instead of auto-generated id for the ad instance, it is now default to adUnitId.

The change is introduced to avoid new instances are being created after the webview is reloaded.

The id property is used to reference the same instance in the native code, so it should be the same between page reload.

You should set the id to a different value if you are displaying multiple ads with the same adUnitId.

Remove ad-type specific events

The following events are removed.

  • admob.banner.load
  • admob.banner.loadfail
  • admob.banner.impression
  • admob.interstitial.load
  • admob.interstitial.loadfail
  • admob.interstitial.dismiss
  • admob.rewarded.load
  • admob.rewarded.loadfail
  • admob.rewarded.reward
  • admob.rewarded.dismiss

They are replaced with* events.

It is recommend to use on method provided by the ad class,

banner = new admob.BannerAd({
adUnitId: 'ca-app-pub-xxx/yyy',

banner.on('impression', async (evt) => {
await banner.hide()

To listen the event via document.addEventListener,

document.addEventListener('', async (evt) => {
if ( instanceof admob.NativeAd) {
// handle event here