The 2017 Ionic Developer Survey Results are in!

AdMob Free

Improve this doc

Repo: https://github.com/ratson/cordova-plugin-admob-free

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-plugin-admob-free
    $ npm install --save @ionic-native/admob-free
    
  2. Add this plugin to your app's module

Supported platforms

Usage

import { AdMobFree, AdMobFreeBannerConfig } from '@ionic-native/admob-free';


constructor(private admobFree: AdMobFree) { }


...


const bannerConfig: AdMobFreeBannerConfig = {
 // add your config here
 // for the sake of this example we will just use the test config
 isTesting: true,
 autoShow: true
};
this.admobFree.banner.config(bannerConfig);

this.admobFree.banner.prepare()
  .then(() => {
    // banner Ad is ready
    // if we set autoShow to false, then we will need to call the show method here
  })
  .catch(e => console.log(e));

Instance Members

events

Convenience object to get event names

on(event)

Watch an event

Param Type Details
event string

event name

Returns: Observable<any>

banner

Returns the AdMobFreeBanner object

interstitial

Returns the AdMobFreeInterstitial object

rewardVideo

Returns the AdMobFreeRewardVideo object

AdMobFreeBanner

Instance Members

config(options)

Update config.

Param Type Details
options

Returns: AdMobFreeBannerConfig

hide()

Hide the banner.

Returns: Promise<any>

prepare()

Create banner.

Returns: Promise<any>

remove()

Remove the banner.

Returns: Promise<any>

show()

Show the banner.

Returns: Promise<any>

AdMobFreeInterstitial

Instance Members

config(options)

Update config.

Param Type Details
options

Returns: AdMobFreeInterstitialConfig

isReady()

Check if interstitial is ready

Returns: Promise<any>

prepare()

Prepare interstitial

Returns: Promise<any>

show()

Show the interstitial

Returns: Promise<any>

AdMobFreeRewardVideo

Instance Members

config(options)

Update config.

Param Type Details
options

Returns: AdMobFreeRewardVideoConfig

isReady()

Check if reward video is ready

Returns: Promise<any>

prepare()

Prepare reward video

Returns: Promise<any>

show()

Show the reward video

Returns: Promise<any>

AdMobFreeBannerConfig

Param Type Details
id string

Ad Unit ID

(optional)
isTesting boolean

Receiving test ad

(optional)
autoShow boolean

Auto show ad when loaded

(optional)
bannerAtTop boolean

Set to true, to put banner at top

(optional)
overlap boolean

Set to true, to allow banner overlap WebView

(optional)
offsetTopBar boolean

Set to true to avoid ios7 status bar overlap

(optional)
size string

Banner size

(optional)

AdMobFreeInterstitialConfig

Param Type Details
id string

Ad Unit ID

(optional)
isTesting boolean

Receiving test ad

(optional)
autoShow boolean

Auto show ad when loaded

(optional)

AdMobFreeRewardVideoConfig

Param Type Details
id string

Ad Unit ID

(optional)
isTesting boolean

Receiving test ad

(optional)
autoShow boolean

Auto show ad when loaded

(optional)

API

Native

General