Ionic 4 AdMob-Plus Ads

1.4k Views Asked by At
Has anyone got AdMob-Plus to work successfully with Ionic 4? Using the code below nothing shows up and the promise terminates with error without a message.
import { AdMob } from '@ionic-native/admob-plus/ngx';
constructor(
adMob: AdMob,
platform: Platform){
  this.platform.ready()
  this.adMob.setDevMode(true);
  this.adMob.banner.show({
      id: {          
        android: 'test',
        ios: 'test',
      }
  })
}
I originally went with AdMob Free but didn't want to manually import the iOS SDK for AdMob. The current SDK version throws error ITMS-90809 when submitting to iOS app store.


***EDIT***


The comment below by Naga is the solution
3

There are 3 best solutions below

1
Mahdi Zarei On

some of native plugins will work just on android and ios and this is one of them. this plugin will not work on pc even with build it on the browser. so you have to test it on a native device or an emulator.

0
Naga On

I just came across this issue today. The workaround is to just use the Cordova plugin as recommended here

0
Miquel On

Have you tried with cordova-admob plugin? It has really great docs at https://ionic-admob.com

ionic plugin add cordova-admob
npm i @ionic-native/admob

You can use it like this:

import { Component, OnInit } from '@angular/core';
import { Platform } from 'ionic-angular';
import { Admob } from '@ionic-native/admob/ngx';

@Component({
    selector: 'app-home',
    templateUrl: 'home.page.html',
})
export class HomePage implements OnInit {
    constructor(private admob: Admob, private platform: Platform) { }

    async ngOnInit() {
        await this.platform.ready();
        await this.admob.createBannerView({
            bannerAdId: 'ca-app-pub-xxxx/xxxx',
        });
    }
}