AdMob with Ionic 2

I am using Ionic 2.

Your system information:

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-beta.11
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.0.0-beta.20
OS:
Node Version: v6.2.2

I have just installed the Cordova plugin cordova-admob-pro:

cordova plugin add cordova-plugin-admobpro

Then as per their instructions, I add the following code:

app.ts

import { AdMob } from 'ionic-native';
....
if (AdMob) AdMob.createBanner({
  adId: admobid.banner,
  position: AdMob.AD_POSITION.BOTTOM_CENTER,
  isTesting: true,//comment this out before publishing the app
  autoShow: true
});

But, I get the following error:

ERROR in ./app/app.ts
(138,23): error TS2339: Property 'AD_POSITION' does not exist on type 'typeof AdMob'.

When I follow the imported code, AdMob is defined in admob.d.ts in the plugin, but it doesn’t have a AD_POSITION:

admob.d.ts

...
export declare class AdMob {
...

If anyone can advise what I am doing wrong, and how I can get a handle on AD_POSITION, I would appreciate it.

Thanks

UPADTE

The problem is because the Admob in ionic-native does not have AD_POSITION, however, if I remove the import from ionic-native, I get:

ERROR in ./app/app.ts
(136,9): error TS2304: Cannot find name 'AdMob'.

I see that AD_POSITION is in plugins\cordova-plugin-admobpro\typescript\AdMob.d.ts. So I gather, this is the one I should be using. But how do I import this one?

UPDATE

This may be the problem. I am just testing it.

enter image description here

UPDATE

This is what I now have, but I still get the error below:

enter image description here

ERROR in ./app/app.ts
(136,9): error TS2304: Cannot find name 'AdMob'.

So basically my problem is, I don’t know how to import the ‘AdMob’ from the plugin.

Bu not importing AdMob, and doing the following instead works:

declare var AdMob: any;

It gives AdMob is not defined now :frowning:

Finally I could make it work …

If anyone still need help, you can follow this tutorial: Adding AdMob In Ionic 2

I followed your tutorial… but still not resolved…
Hello can you help me. Ads are not coming in my android app. But the testing ads are working fine. I am using ionic 2

Make sure the ad unit ID you’re pasting are of banner ads …
Other than this, there won’t be any other issues.