Socket
Socket
Sign inDemoInstall

@capacitor-community/admob

Package Overview
Dependencies
Maintainers
31
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capacitor-community/admob - npm Package Compare versions

Comparing version 3.0.0-4 to 3.0.0-5

android/src/main/java/com/getcapacitor/community/admob/banner/BannerAdPluginEvents.kt

896

dist/docs.json

@@ -38,595 +38,2 @@ {

"slug": "initialize"
},
{
"name": "showBanner",
"signature": "(options: AdOptions) => Promise<void>",
"parameters": [
{
"name": "options",
"docs": "AdOptions",
"type": "AdOptions"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "group",
"text": "Banner"
},
{
"name": "param",
"text": "options AdOptions"
},
{
"name": "since",
"text": "1.1.2"
}
],
"docs": "Show a banner Ad",
"complexTypes": [
"AdOptions"
],
"slug": "showbanner"
},
{
"name": "hideBanner",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<void>",
"tags": [
{
"name": "group",
"text": "Banner"
},
{
"name": "since",
"text": "1.1.2"
}
],
"docs": "Hide the banner, remove it from screen, but can show it later",
"complexTypes": [],
"slug": "hidebanner"
},
{
"name": "resumeBanner",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<void>",
"tags": [
{
"name": "group",
"text": "Banner"
},
{
"name": "since",
"text": "1.1.2"
}
],
"docs": "Resume the banner, show it after hide",
"complexTypes": [],
"slug": "resumebanner"
},
{
"name": "removeBanner",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<void>",
"tags": [
{
"name": "group",
"text": "Banner"
},
{
"name": "since",
"text": "1.1.2"
}
],
"docs": "Destroy the banner, remove it from screen.",
"complexTypes": [],
"slug": "removebanner"
},
{
"name": "prepareInterstitial",
"signature": "(options: AdOptions) => Promise<void>",
"parameters": [
{
"name": "options",
"docs": "AdOptions",
"type": "AdOptions"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "group",
"text": "Interstitial"
},
{
"name": "param",
"text": "options AdOptions"
},
{
"name": "since",
"text": "1.1.2"
}
],
"docs": "Prepare interstitial banner",
"complexTypes": [
"AdOptions"
],
"slug": "prepareinterstitial"
},
{
"name": "showInterstitial",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<void>",
"tags": [
{
"name": "group",
"text": "Interstitial"
},
{
"name": "since",
"text": "1.1.2"
}
],
"docs": "Show interstitial ad when it’s ready",
"complexTypes": [],
"slug": "showinterstitial"
},
{
"name": "prepareRewardVideoAd",
"signature": "(options: AdOptions) => Promise<void>",
"parameters": [
{
"name": "options",
"docs": "AdOptions",
"type": "AdOptions"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "group",
"text": "RewardVideo"
},
{
"name": "param",
"text": "options AdOptions"
},
{
"name": "since",
"text": "1.1.2"
}
],
"docs": "Prepare a reward video ad",
"complexTypes": [
"AdOptions"
],
"slug": "preparerewardvideoad"
},
{
"name": "showRewardVideoAd",
"signature": "() => Promise<AdMobRewardItem>",
"parameters": [],
"returns": "Promise<AdMobRewardItem>",
"tags": [
{
"name": "group",
"text": "RewardVideo"
},
{
"name": "since",
"text": "1.1.2"
}
],
"docs": "Show a reward video ad",
"complexTypes": [
"AdMobRewardItem"
],
"slug": "showrewardvideoad"
},
{
"name": "addListener",
"signature": "(eventName: 'bannerViewChangeSize', listenerFunc: (info: AdMobBannerSize) => void) => PluginListenerHandle",
"parameters": [
{
"name": "eventName",
"docs": "bannerViewChangeSize",
"type": "\"bannerViewChangeSize\""
},
{
"name": "listenerFunc",
"docs": "",
"type": "(info: AdMobBannerSize) => void"
}
],
"returns": "PluginListenerHandle",
"tags": [
{
"name": "group",
"text": "Banner"
},
{
"name": "param",
"text": "eventName bannerViewChangeSize"
},
{
"name": "param",
"text": "listenerFunc"
},
{
"name": "since",
"text": "3.0.0"
}
],
"docs": "",
"complexTypes": [
"PluginListenerHandle",
"AdMobBannerSize"
],
"slug": "addlistener"
},
{
"name": "addListener",
"signature": "(eventName: 'bannerViewDidReceiveAd', listenerFunc: () => void) => PluginListenerHandle",
"parameters": [
{
"name": "eventName",
"docs": "bannerViewDidReceiveAd",
"type": "\"bannerViewDidReceiveAd\""
},
{
"name": "listenerFunc",
"docs": "",
"type": "() => void"
}
],
"returns": "PluginListenerHandle",
"tags": [
{
"name": "group",
"text": "Banner"
},
{
"name": "param",
"text": "eventName bannerViewDidReceiveAd"
},
{
"name": "param",
"text": "listenerFunc"
},
{
"name": "since",
"text": "3.0.0"
}
],
"docs": "Notice: request loaded Banner ad",
"complexTypes": [
"PluginListenerHandle"
],
"slug": "addlistener"
},
{
"name": "addListener",
"signature": "(eventName: 'bannerView:didFailToReceiveAdWithError', listenerFunc: (info: AdMobError) => void) => PluginListenerHandle",
"parameters": [
{
"name": "eventName",
"docs": "bannerView:didFailToReceiveAdWithError",
"type": "\"bannerView:didFailToReceiveAdWithError\""
},
{
"name": "listenerFunc",
"docs": "",
"type": "(info: AdMobError) => void"
}
],
"returns": "PluginListenerHandle",
"tags": [
{
"name": "group",
"text": "Banner"
},
{
"name": "param",
"text": "eventName bannerView:didFailToReceiveAdWithError"
},
{
"name": "param",
"text": "listenerFunc"
},
{
"name": "since",
"text": "3.0.0"
}
],
"docs": "Notice: request failed Banner ad",
"complexTypes": [
"PluginListenerHandle",
"AdMobError"
],
"slug": "addlistener"
},
{
"name": "addListener",
"signature": "(eventName: 'bannerViewWillPresentScreen', listenerFunc: (info: any) => void) => PluginListenerHandle",
"parameters": [
{
"name": "eventName",
"docs": "bannerViewWillPresentScreen",
"type": "\"bannerViewWillPresentScreen\""
},
{
"name": "listenerFunc",
"docs": "",
"type": "(info: any) => void"
}
],
"returns": "PluginListenerHandle",
"tags": [
{
"name": "group",
"text": "Banner"
},
{
"name": "param",
"text": "eventName bannerViewWillPresentScreen"
},
{
"name": "param",
"text": "listenerFunc"
},
{
"name": "since",
"text": "3.0.0"
}
],
"docs": "Notice: full-screen banner view will be presented in response to the user clicking on an ad.",
"complexTypes": [
"PluginListenerHandle"
],
"slug": "addlistener"
},
{
"name": "addListener",
"signature": "(eventName: 'bannerViewWillDismissScreen', listenerFunc: (info: any) => void) => PluginListenerHandle",
"parameters": [
{
"name": "eventName",
"docs": "bannerViewWillDismissScreen",
"type": "\"bannerViewWillDismissScreen\""
},
{
"name": "listenerFunc",
"docs": "",
"type": "(info: any) => void"
}
],
"returns": "PluginListenerHandle",
"tags": [
{
"name": "group",
"text": "Banner"
},
{
"name": "param",
"text": "eventName bannerViewWillDismissScreen"
},
{
"name": "param",
"text": "listenerFunc"
},
{
"name": "since",
"text": "3.0.0"
}
],
"docs": "Notice: The full-screen banner view will be dismissed.",
"complexTypes": [
"PluginListenerHandle"
],
"slug": "addlistener"
},
{
"name": "addListener",
"signature": "(eventName: 'bannerViewWillDismissScreen', listenerFunc: (info: any) => void) => PluginListenerHandle",
"parameters": [
{
"name": "eventName",
"docs": "bannerViewWillDismissScreen",
"type": "\"bannerViewWillDismissScreen\""
},
{
"name": "listenerFunc",
"docs": "",
"type": "(info: any) => void"
}
],
"returns": "PluginListenerHandle",
"tags": [
{
"name": "group",
"text": "Banner"
},
{
"name": "param",
"text": "eventName bannerViewWillDismissScreen"
},
{
"name": "param",
"text": "listenerFunc"
},
{
"name": "since",
"text": "3.0.0"
}
],
"docs": "Notice: The full-screen banner view will been dismissed.",
"complexTypes": [
"PluginListenerHandle"
],
"slug": "addlistener"
},
{
"name": "addListener",
"signature": "(eventName: 'bannerViewDidDismissScreen', listenerFunc: (info: any) => void) => PluginListenerHandle",
"parameters": [
{
"name": "eventName",
"docs": "bannerViewDidDismissScreen",
"type": "\"bannerViewDidDismissScreen\""
},
{
"name": "listenerFunc",
"docs": "",
"type": "(info: any) => void"
}
],
"returns": "PluginListenerHandle",
"tags": [
{
"name": "group",
"text": "Banner"
},
{
"name": "param",
"text": "eventName bannerViewDidDismissScreen"
},
{
"name": "param",
"text": "listenerFunc"
},
{
"name": "since",
"text": "3.0.0"
}
],
"docs": "Notice: The full-screen banner view has been dismissed.",
"complexTypes": [
"PluginListenerHandle"
],
"slug": "addlistener"
},
{
"name": "addListener",
"signature": "(eventName: 'adDidPresentFullScreenContent', listenerFunc: (info: any) => void) => PluginListenerHandle",
"parameters": [
{
"name": "eventName",
"docs": "adDidPresentFullScreenContent",
"type": "\"adDidPresentFullScreenContent\""
},
{
"name": "listenerFunc",
"docs": "",
"type": "(info: any) => void"
}
],
"returns": "PluginListenerHandle",
"tags": [
{
"name": "group",
"text": "fullscreen"
},
{
"name": "param",
"text": "eventName adDidPresentFullScreenContent"
},
{
"name": "param",
"text": "listenerFunc"
},
{
"name": "since",
"text": "3.0.0"
}
],
"docs": "Notice: Interstitial ad opened",
"complexTypes": [
"PluginListenerHandle"
],
"slug": "addlistener"
},
{
"name": "addListener",
"signature": "(eventName: 'adDidDismissFullScreenContent', listenerFunc: (info: any) => void) => PluginListenerHandle",
"parameters": [
{
"name": "eventName",
"docs": "adDidDismissFullScreenContent",
"type": "\"adDidDismissFullScreenContent\""
},
{
"name": "listenerFunc",
"docs": "",
"type": "(info: any) => void"
}
],
"returns": "PluginListenerHandle",
"tags": [
{
"name": "group",
"text": "fullscreen"
},
{
"name": "param",
"text": "eventName adDidDismissFullScreenContent"
},
{
"name": "param",
"text": "listenerFunc"
},
{
"name": "since",
"text": "3.0.0"
}
],
"docs": "Notice: Dismiss Content",
"complexTypes": [
"PluginListenerHandle"
],
"slug": "addlistener"
},
{
"name": "addListener",
"signature": "(eventName: 'didFailToPresentFullScreenContentWithError', listenerFunc: (info: AdMobError) => void) => PluginListenerHandle",
"parameters": [
{
"name": "eventName",
"docs": "didFailToPresentFullScreenContentWithError",
"type": "\"didFailToPresentFullScreenContentWithError\""
},
{
"name": "listenerFunc",
"docs": "",
"type": "(info: AdMobError) => void"
}
],
"returns": "PluginListenerHandle",
"tags": [
{
"name": "group",
"text": "fullscreen"
},
{
"name": "param",
"text": "eventName didFailToPresentFullScreenContentWithError"
},
{
"name": "param",
"text": "listenerFunc"
},
{
"name": "since",
"text": "3.0.0"
}
],
"docs": "Notice: Interstitial ad is be failed to open",
"complexTypes": [
"PluginListenerHandle",
"AdMobError"
],
"slug": "addlistener"
}

@@ -697,306 +104,5 @@ ],

]
},
{
"name": "AdOptions",
"slug": "adoptions",
"docs": "",
"tags": [],
"methods": [],
"properties": [
{
"name": "adId",
"tags": [
{
"text": "https://support.google.com/admob/answer/7356431?hl=en",
"name": "see"
},
{
"text": "1.1.2",
"name": "since"
}
],
"docs": "The ad unit ID that you want to request",
"complexTypes": [],
"type": "string"
},
{
"name": "adSize",
"tags": [
{
"text": "SMART_BANNER",
"name": "default"
},
{
"text": "1.1.2",
"name": "since"
}
],
"docs": "Banner Ad Size, defaults to SMART_BANNER.\nIT can be: SMART_BANNER, BANNER, MEDIUM_RECTANGLE,\nFULL_BANNER, LEADERBOARD, SKYSCRAPER, or CUSTOM",
"complexTypes": [
"AdSize"
],
"type": "AdSize | undefined"
},
{
"name": "position",
"tags": [
{
"text": "TOP_CENTER",
"name": "default"
},
{
"text": "1.1.2",
"name": "since"
}
],
"docs": "Set Banner Ad position.\nTOP_CENTER or CENTER or BOTTOM_CENTER",
"complexTypes": [
"AdPosition"
],
"type": "AdPosition | undefined"
},
{
"name": "isTesting",
"tags": [
{
"text": "false",
"name": "default"
},
{
"text": "1.1.2",
"name": "since"
}
],
"docs": "You can use test mode of ad.",
"complexTypes": [],
"type": "boolean | undefined"
},
{
"name": "margin",
"tags": [
{
"text": "0",
"name": "default"
},
{
"text": "1.1.2",
"name": "since"
}
],
"docs": "Margin Banner. Default is 0px;\nIf position is BOTTOM_CENTER, margin is be margin-bottom.\nIf position is TOP_CENTER, margin is be margin-top.",
"complexTypes": [],
"type": "number | undefined"
},
{
"name": "npa",
"tags": [
{
"text": "https://developers.google.com/admob/ios/eu-consent",
"name": "see"
},
{
"text": "https://developers.google.com/admob/android/eu-consent",
"name": "see"
},
{
"text": "false",
"name": "default"
},
{
"text": "1.2.0",
"name": "since"
}
],
"docs": "The default behavior of the Google Mobile Ads SDK is to serve personalized ads.\nSet this to true to request Non-Personalized Ads",
"complexTypes": [],
"type": "boolean | undefined"
}
]
},
{
"name": "AdMobRewardItem",
"slug": "admobrewarditem",
"docs": "For more information\nhttps://developers.google.com/admob/android/rewarded-video-adapters?hl=en",
"tags": [],
"methods": [],
"properties": [
{
"name": "type",
"tags": [],
"docs": "Rewarded type user got",
"complexTypes": [],
"type": "string"
},
{
"name": "amount",
"tags": [],
"docs": "Rewarded amount user got",
"complexTypes": [],
"type": "number"
}
]
},
{
"name": "PluginListenerHandle",
"slug": "pluginlistenerhandle",
"docs": "",
"tags": [],
"methods": [],
"properties": [
{
"name": "remove",
"tags": [],
"docs": "",
"complexTypes": [],
"type": "() => Promise<void>"
}
]
},
{
"name": "AdMobBannerSize",
"slug": "admobbannersize",
"docs": "When notice listener of OnAdLoaded, you can get banner size.",
"tags": [],
"methods": [],
"properties": [
{
"name": "width",
"tags": [],
"docs": "",
"complexTypes": [],
"type": "number"
},
{
"name": "height",
"tags": [],
"docs": "",
"complexTypes": [],
"type": "number"
}
]
},
{
"name": "AdMobError",
"slug": "admoberror",
"docs": "For more information\nhttps://developers.google.com/android/reference/com/google/android/gms/ads/AdError",
"tags": [],
"methods": [],
"properties": [
{
"name": "code",
"tags": [],
"docs": "Gets the error's code.",
"complexTypes": [],
"type": "number"
},
{
"name": "message",
"tags": [],
"docs": "Gets the message describing the error.",
"complexTypes": [],
"type": "string"
},
{
"name": "cause",
"tags": [],
"docs": "Gets the cause of this error or null if the cause is nonexistent or unknown.",
"complexTypes": [],
"type": "string"
},
{
"name": "domain",
"tags": [],
"docs": "Gets the domain of the error.\nMobileAds.ERROR_DOMAIN for Google Mobile Ads SDK errors, or a domain defined by mediation networks for mediation errors.",
"complexTypes": [],
"type": "string"
}
]
}
],
"enums": [
{
"name": "AdSize",
"slug": "adsize",
"members": [
{
"name": "BANNER",
"value": "'BANNER'",
"tags": [],
"docs": "Mobile Marketing Association (MMA)\nbanner ad size (320x50 density-independent pixels)."
},
{
"name": "FLUID",
"value": "'FLUID'",
"tags": [],
"docs": "A dynamically sized banner that matches its parent's\nwidth and expands/contracts its height to match the ad's\ncontent after loading completes."
},
{
"name": "FULL_BANNER",
"value": "'FULL_BANNER'",
"tags": [],
"docs": "Interactive Advertising Bureau (IAB)\nfull banner ad size (468x60 density-independent pixels)."
},
{
"name": "LARGE_BANNER",
"value": "'LARGE_BANNER'",
"tags": [],
"docs": "Large banner ad size (320x100 density-independent pixels)."
},
{
"name": "LEADERBOARD",
"value": "'LEADERBOARD'",
"tags": [],
"docs": "Interactive Advertising Bureau (IAB)\nleaderboard ad size (728x90 density-independent pixels)."
},
{
"name": "MEDIUM_RECTANGLE",
"value": "'MEDIUM_RECTANGLE'",
"tags": [],
"docs": "Interactive Advertising Bureau (IAB)\nmedium rectangle ad size (300x250 density-independent pixels)."
},
{
"name": "SMART_BANNER",
"value": "'SMART_BANNER'",
"tags": [],
"docs": "deprecated: A dynamically sized banner that is full-width and auto-height."
},
{
"name": "ADAPTIVE_BANNER",
"value": "'ADAPTIVE_BANNER'",
"tags": [],
"docs": "A dynamically sized banner that is full-width and auto-height."
},
{
"name": "CUSTOM",
"value": "'CUSTOM'",
"tags": [],
"docs": "To define a custom banner size, set your desired AdSize"
}
]
},
{
"name": "AdPosition",
"slug": "adposition",
"members": [
{
"name": "TOP_CENTER",
"value": "'TOP_CENTER'",
"tags": [],
"docs": "Banner position be top-center"
},
{
"name": "CENTER",
"value": "'CENTER'",
"tags": [],
"docs": "Banner position be center"
},
{
"name": "BOTTOM_CENTER",
"value": "'BOTTOM_CENTER'",
"tags": [],
"docs": "Banner position be bottom-center(default)"
}
]
}
]
"enums": []
}

@@ -1,3 +0,6 @@

import type { PluginListenerHandle } from '@capacitor/core';
export interface AdMobPlugin {
import type { BannerDefinitions } from './banner';
import type { InterstitialDefinitions } from './interstitial';
import type { RewardDefinitions } from './reward';
declare type AdMobDefinitions = BannerDefinitions & RewardDefinitions & InterstitialDefinitions;
export interface AdMobPlugin extends AdMobDefinitions {
/**

@@ -11,150 +14,2 @@ * Initialize AdMob with AdMobInitializationOptions

initialize(options: AdMobInitializationOptions): Promise<void>;
/**
* Show a banner Ad
*
* @group Banner
* @param options AdOptions
* @since 1.1.2
*/
showBanner(options: AdOptions): Promise<void>;
/**
* Hide the banner, remove it from screen, but can show it later
*
* @group Banner
* @since 1.1.2
*/
hideBanner(): Promise<void>;
/**
* Resume the banner, show it after hide
*
* @group Banner
* @since 1.1.2
*/
resumeBanner(): Promise<void>;
/**
* Destroy the banner, remove it from screen.
*
* @group Banner
* @since 1.1.2
*/
removeBanner(): Promise<void>;
/**
* Prepare interstitial banner
*
* @group Interstitial
* @param options AdOptions
* @since 1.1.2
*/
prepareInterstitial(options: AdOptions): Promise<void>;
/**
* Show interstitial ad when it’s ready
*
* @group Interstitial
* @since 1.1.2
*/
showInterstitial(): Promise<void>;
/**
* Prepare a reward video ad
*
* @group RewardVideo
* @param options AdOptions
* @since 1.1.2
*/
prepareRewardVideoAd(options: AdOptions): Promise<void>;
/**
* Show a reward video ad
*
* @group RewardVideo
* @since 1.1.2
*/
showRewardVideoAd(): Promise<AdMobRewardItem>;
/**
*
* @group Banner
* @param eventName bannerViewChangeSize
* @param listenerFunc
* @since 3.0.0
*/
addListener(eventName: 'bannerViewChangeSize', listenerFunc: (info: AdMobBannerSize) => void): PluginListenerHandle;
/**
* Notice: request loaded Banner ad
*
* @group Banner
* @param eventName bannerViewDidReceiveAd
* @param listenerFunc
* @since 3.0.0
*/
addListener(eventName: 'bannerViewDidReceiveAd', listenerFunc: () => void): PluginListenerHandle;
/**
* Notice: request failed Banner ad
*
* @group Banner
* @param eventName bannerView:didFailToReceiveAdWithError
* @param listenerFunc
* @since 3.0.0
*/
addListener(eventName: 'bannerView:didFailToReceiveAdWithError', listenerFunc: (info: AdMobError) => void): PluginListenerHandle;
/**
* Notice: full-screen banner view will be presented in response to the user clicking on an ad.
*
* @group Banner
* @param eventName bannerViewWillPresentScreen
* @param listenerFunc
* @since 3.0.0
*/
addListener(eventName: 'bannerViewWillPresentScreen', listenerFunc: (info: any) => void): PluginListenerHandle;
/**
* Notice: The full-screen banner view will be dismissed.
*
* @group Banner
* @param eventName bannerViewWillDismissScreen
* @param listenerFunc
* @since 3.0.0
*/
addListener(eventName: 'bannerViewWillDismissScreen', listenerFunc: (info: any) => void): PluginListenerHandle;
/**
* Notice: The full-screen banner view will been dismissed.
*
* @group Banner
* @param eventName bannerViewWillDismissScreen
* @param listenerFunc
* @since 3.0.0
*/
addListener(eventName: 'bannerViewWillDismissScreen', listenerFunc: (info: any) => void): PluginListenerHandle;
/**
* Notice: The full-screen banner view has been dismissed.
*
* @group Banner
* @param eventName bannerViewDidDismissScreen
* @param listenerFunc
* @since 3.0.0
*/
addListener(eventName: 'bannerViewDidDismissScreen', listenerFunc: (info: any) => void): PluginListenerHandle;
/**
* Notice: Interstitial ad opened
*
* @group fullscreen
* @param eventName adDidPresentFullScreenContent
* @param listenerFunc
* @since 3.0.0
*/
addListener(eventName: 'adDidPresentFullScreenContent', listenerFunc: (info: any) => void): PluginListenerHandle;
/**
* Notice: Dismiss Content
*
* @group fullscreen
* @param eventName adDidDismissFullScreenContent
* @param listenerFunc
* @since 3.0.0
*/
addListener(eventName: 'adDidDismissFullScreenContent', listenerFunc: (info: any) => void): PluginListenerHandle;
/**
* Notice: Interstitial ad is be failed to open
*
* @group fullscreen
* @param eventName didFailToPresentFullScreenContentWithError
* @param listenerFunc
* @since 3.0.0
*/
addListener(eventName: 'didFailToPresentFullScreenContentWithError', listenerFunc: (info: AdMobError) => void): PluginListenerHandle;
}

@@ -187,163 +42,2 @@ export interface AdMobInitializationOptions {

}
export interface AdOptions {
/**
* The ad unit ID that you want to request
*
* @see https://support.google.com/admob/answer/7356431?hl=en
* @since 1.1.2
*/
adId: string;
/**
* Banner Ad Size, defaults to SMART_BANNER.
* IT can be: SMART_BANNER, BANNER, MEDIUM_RECTANGLE,
* FULL_BANNER, LEADERBOARD, SKYSCRAPER, or CUSTOM
*
* @default SMART_BANNER
* @since 1.1.2
*/
adSize?: AdSize;
/**
* Set Banner Ad position.
* TOP_CENTER or CENTER or BOTTOM_CENTER
*
* @default TOP_CENTER
* @since 1.1.2
*/
position?: AdPosition;
/**
* You can use test mode of ad.
*
* @default false
* @since 1.1.2
*/
isTesting?: boolean;
/**
* Margin Banner. Default is 0px;
* If position is BOTTOM_CENTER, margin is be margin-bottom.
* If position is TOP_CENTER, margin is be margin-top.
*
* @default 0
* @since 1.1.2
*/
margin?: number;
/**
* The default behavior of the Google Mobile Ads SDK is to serve personalized ads.
* Set this to true to request Non-Personalized Ads
*
* @see https://developers.google.com/admob/ios/eu-consent
* @see https://developers.google.com/admob/android/eu-consent
* @default false
* @since 1.2.0
*/
npa?: boolean;
}
/**
* For more information
* https://developers.google.com/admob/android/rewarded-video-adapters?hl=en
*/
export interface AdMobRewardItem {
/**
* Rewarded type user got
*/
type: string;
/**
* Rewarded amount user got
*/
amount: number;
}
/**
* When notice listener of OnAdLoaded, you can get banner size.
*/
export interface AdMobBannerSize {
width: number;
height: number;
}
/**
* For more information
* https://developers.google.com/android/reference/com/google/android/gms/ads/AdError
*/
export interface AdMobError {
/**
* Gets the error's code.
*/
code: number;
/**
* Gets the message describing the error.
*/
message: string;
/**
* Gets the cause of this error or null if the cause is nonexistent or unknown.
*/
cause: string;
/**
* Gets the domain of the error.
* MobileAds.ERROR_DOMAIN for Google Mobile Ads SDK errors, or a domain defined by mediation networks for mediation errors.
*/
domain: string;
}
/**
* For more information:
* https://developers.google.com/admob/ios/banner#banner_sizes
* https://developers.google.com/android/reference/com/google/android/gms/ads/AdSize
* */
export declare enum AdSize {
/**
* Mobile Marketing Association (MMA)
* banner ad size (320x50 density-independent pixels).
*/
BANNER = "BANNER",
/**
* A dynamically sized banner that matches its parent's
* width and expands/contracts its height to match the ad's
* content after loading completes.
*/
FLUID = "FLUID",
/**
* Interactive Advertising Bureau (IAB)
* full banner ad size (468x60 density-independent pixels).
*/
FULL_BANNER = "FULL_BANNER",
/**
* Large banner ad size (320x100 density-independent pixels).
*/
LARGE_BANNER = "LARGE_BANNER",
/**
* Interactive Advertising Bureau (IAB)
* leaderboard ad size (728x90 density-independent pixels).
*/
LEADERBOARD = "LEADERBOARD",
/**
* Interactive Advertising Bureau (IAB)
* medium rectangle ad size (300x250 density-independent pixels).
*/
MEDIUM_RECTANGLE = "MEDIUM_RECTANGLE",
/**
* deprecated: A dynamically sized banner that is full-width and auto-height.
*/
SMART_BANNER = "SMART_BANNER",
/**
* A dynamically sized banner that is full-width and auto-height.
*/
ADAPTIVE_BANNER = "ADAPTIVE_BANNER",
/**
* To define a custom banner size, set your desired AdSize
*/
CUSTOM = "CUSTOM"
}
/**
* @see https://developer.android.com/reference/android/widget/LinearLayout#attr_android:gravity
*/
export declare enum AdPosition {
/**
* Banner position be top-center
*/
TOP_CENTER = "TOP_CENTER",
/**
* Banner position be center
*/
CENTER = "CENTER",
/**
* Banner position be bottom-center(default)
*/
BOTTOM_CENTER = "BOTTOM_CENTER"
}
export {};

@@ -1,69 +0,2 @@

/**
* For more information:
* https://developers.google.com/admob/ios/banner#banner_sizes
* https://developers.google.com/android/reference/com/google/android/gms/ads/AdSize
* */
export var AdSize;
(function (AdSize) {
/**
* Mobile Marketing Association (MMA)
* banner ad size (320x50 density-independent pixels).
*/
AdSize["BANNER"] = "BANNER";
/**
* A dynamically sized banner that matches its parent's
* width and expands/contracts its height to match the ad's
* content after loading completes.
*/
AdSize["FLUID"] = "FLUID";
/**
* Interactive Advertising Bureau (IAB)
* full banner ad size (468x60 density-independent pixels).
*/
AdSize["FULL_BANNER"] = "FULL_BANNER";
/**
* Large banner ad size (320x100 density-independent pixels).
*/
AdSize["LARGE_BANNER"] = "LARGE_BANNER";
/**
* Interactive Advertising Bureau (IAB)
* leaderboard ad size (728x90 density-independent pixels).
*/
AdSize["LEADERBOARD"] = "LEADERBOARD";
/**
* Interactive Advertising Bureau (IAB)
* medium rectangle ad size (300x250 density-independent pixels).
*/
AdSize["MEDIUM_RECTANGLE"] = "MEDIUM_RECTANGLE";
/**
* deprecated: A dynamically sized banner that is full-width and auto-height.
*/
AdSize["SMART_BANNER"] = "SMART_BANNER";
/**
* A dynamically sized banner that is full-width and auto-height.
*/
AdSize["ADAPTIVE_BANNER"] = "ADAPTIVE_BANNER";
/**
* To define a custom banner size, set your desired AdSize
*/
AdSize["CUSTOM"] = "CUSTOM";
})(AdSize || (AdSize = {}));
/**
* @see https://developer.android.com/reference/android/widget/LinearLayout#attr_android:gravity
*/
export var AdPosition;
(function (AdPosition) {
/**
* Banner position be top-center
*/
AdPosition["TOP_CENTER"] = "TOP_CENTER";
/**
* Banner position be center
*/
AdPosition["CENTER"] = "CENTER";
/**
* Banner position be bottom-center(default)
*/
AdPosition["BOTTOM_CENTER"] = "BOTTOM_CENTER";
})(AdPosition || (AdPosition = {}));
export {};
//# sourceMappingURL=definitions.js.map
import type { AdMobPlugin } from './definitions';
declare const AdMob: AdMobPlugin;
export * from './definitions';
export * from './banner/index';
export * from './interstitial/index';
export * from './reward/index';
export * from './shared/index';
export { AdMob };

@@ -6,3 +6,7 @@ import { registerPlugin } from '@capacitor/core';

export * from './definitions';
export * from './banner/index';
export * from './interstitial/index';
export * from './reward/index';
export * from './shared/index';
export { AdMob };
//# sourceMappingURL=index.js.map
import { WebPlugin } from '@capacitor/core';
import type { AdMobRewardItem, AdOptions, AdMobPlugin } from './definitions';
import type { AdMobPlugin } from '.';
import type { AdMobRewardItem } from './reward';
import type { AdOptions, AdLoadInfo } from './shared';
export declare class AdMobWeb extends WebPlugin implements AdMobPlugin {

@@ -10,6 +12,6 @@ constructor();

removeBanner(): Promise<void>;
prepareInterstitial(options: AdOptions): Promise<void>;
prepareInterstitial(options: AdOptions): Promise<AdLoadInfo>;
showInterstitial(): Promise<void>;
prepareRewardVideoAd(options: AdOptions): Promise<void>;
prepareRewardVideoAd(options: AdOptions): Promise<AdLoadInfo>;
showRewardVideoAd(): Promise<AdMobRewardItem>;
}

@@ -10,27 +10,33 @@ import { WebPlugin } from '@capacitor/core';

async initialize() {
console.log();
console.log('initialize');
}
async showBanner(options) {
console.log(options);
console.log('showBanner', options);
}
// Hide the banner, remove it from screen, but can show it later
async hideBanner() {
console.log();
console.log('hideBanner');
}
// Resume the banner, show it after hide
async resumeBanner() {
console.log();
console.log('resumeBanner');
}
// Destroy the banner, remove it from screen.
async removeBanner() {
console.log();
console.log('removeBanner');
}
async prepareInterstitial(options) {
console.log(options);
console.log('prepareInterstitial', options);
return {
adUnitId: options.adId,
};
}
async showInterstitial() {
console.log();
console.log('showInterstitial');
}
async prepareRewardVideoAd(options) {
console.log(options);
return {
adUnitId: options.adId,
};
}

@@ -37,0 +43,0 @@ async showRewardVideoAd() {

@@ -7,9 +7,46 @@ 'use strict';

// This enum should be keep in sync with their native equivalents with the same name
exports.BannerAdPluginEvents = void 0;
(function (BannerAdPluginEvents) {
BannerAdPluginEvents["SizeChanged"] = "bannerAdSizeChanged";
BannerAdPluginEvents["Loaded"] = "bannerAdLoaded";
BannerAdPluginEvents["FailedToLoad"] = "bannerAdFailedToLoad";
/**
* Open or close "Adsense" Event after user click banner
*/
BannerAdPluginEvents["Opened"] = "bannerAdOpened";
BannerAdPluginEvents["Closed"] = "bannerAdClosed";
/**
* Similarly, this method should be called when an impression is recorded for the ad by the mediated SDK.
*/
BannerAdPluginEvents["AdImpression"] = "bannerAdImpression";
})(exports.BannerAdPluginEvents || (exports.BannerAdPluginEvents = {}));
/**
* @see https://developer.android.com/reference/android/widget/LinearLayout#attr_android:gravity
*/
exports.BannerAdPosition = void 0;
(function (BannerAdPosition) {
/**
* Banner position be top-center
*/
BannerAdPosition["TOP_CENTER"] = "TOP_CENTER";
/**
* Banner position be center
*/
BannerAdPosition["CENTER"] = "CENTER";
/**
* Banner position be bottom-center(default)
*/
BannerAdPosition["BOTTOM_CENTER"] = "BOTTOM_CENTER";
})(exports.BannerAdPosition || (exports.BannerAdPosition = {}));
/**
* For more information:
* https://developers.google.com/admob/ios/banner#banner_sizes
* https://developers.google.com/android/reference/com/google/android/gms/ads/AdSize
*
* */
exports.AdSize = void 0;
(function (AdSize) {
exports.BannerAdSize = void 0;
(function (BannerAdSize) {
/**

@@ -19,18 +56,12 @@ * Mobile Marketing Association (MMA)

*/
AdSize["BANNER"] = "BANNER";
BannerAdSize["BANNER"] = "BANNER";
/**
* A dynamically sized banner that matches its parent's
* width and expands/contracts its height to match the ad's
* content after loading completes.
*/
AdSize["FLUID"] = "FLUID";
/**
* Interactive Advertising Bureau (IAB)
* full banner ad size (468x60 density-independent pixels).
*/
AdSize["FULL_BANNER"] = "FULL_BANNER";
BannerAdSize["FULL_BANNER"] = "FULL_BANNER";
/**
* Large banner ad size (320x100 density-independent pixels).
*/
AdSize["LARGE_BANNER"] = "LARGE_BANNER";
BannerAdSize["LARGE_BANNER"] = "LARGE_BANNER";
/**

@@ -40,3 +71,3 @@ * Interactive Advertising Bureau (IAB)

*/
AdSize["LEADERBOARD"] = "LEADERBOARD";
BannerAdSize["LEADERBOARD"] = "LEADERBOARD";
/**

@@ -46,35 +77,64 @@ * Interactive Advertising Bureau (IAB)

*/
AdSize["MEDIUM_RECTANGLE"] = "MEDIUM_RECTANGLE";
BannerAdSize["MEDIUM_RECTANGLE"] = "MEDIUM_RECTANGLE";
/**
* deprecated: A dynamically sized banner that is full-width and auto-height.
* A dynamically sized banner that is full-width and auto-height.
*/
AdSize["SMART_BANNER"] = "SMART_BANNER";
BannerAdSize["ADAPTIVE_BANNER"] = "ADAPTIVE_BANNER";
/**
* A dynamically sized banner that is full-width and auto-height.
* Screen width x 32|50|90
*/
AdSize["ADAPTIVE_BANNER"] = "ADAPTIVE_BANNER";
BannerAdSize["SMART_BANNER"] = "SMART_BANNER";
})(exports.BannerAdSize || (exports.BannerAdSize = {}));
// This enum should be keep in sync with their native equivalents with the same name
exports.InterstitialAdPluginEvents = void 0;
(function (InterstitialAdPluginEvents) {
/**
* To define a custom banner size, set your desired AdSize
* Emits after trying to prepare and Interstitial, when it is loaded and ready to be show
*/
AdSize["CUSTOM"] = "CUSTOM";
})(exports.AdSize || (exports.AdSize = {}));
/**
* @see https://developer.android.com/reference/android/widget/LinearLayout#attr_android:gravity
*/
exports.AdPosition = void 0;
(function (AdPosition) {
InterstitialAdPluginEvents["Loaded"] = "interstitialAdLoaded";
/**
* Banner position be top-center
* Emits after trying to prepare and Interstitial, when it could not be loaded
*/
AdPosition["TOP_CENTER"] = "TOP_CENTER";
InterstitialAdPluginEvents["FailedToLoad"] = "interstitialAdFailedToLoad";
/**
* Banner position be center
* Emits when the Interstitial ad is visible to the user
*/
AdPosition["CENTER"] = "CENTER";
InterstitialAdPluginEvents["Showed"] = "interstitialAdShowed";
InterstitialAdPluginEvents["FailedToShow"] = "interstitialAdFailedToShow";
/**
* Banner position be bottom-center(default)
* Emits when the Interstitial ad is not visible to the user anymore.
*/
AdPosition["BOTTOM_CENTER"] = "BOTTOM_CENTER";
})(exports.AdPosition || (exports.AdPosition = {}));
InterstitialAdPluginEvents["Dismissed"] = "interstitialAdDismissed";
})(exports.InterstitialAdPluginEvents || (exports.InterstitialAdPluginEvents = {}));
// This enum should be keep in sync with their native equivalents with the same name
exports.RewardAdPluginEvents = void 0;
(function (RewardAdPluginEvents) {
/**
* Emits after trying to prepare a RewardAd and the Video is loaded and ready to be show
*/
RewardAdPluginEvents["Loaded"] = "onRewardedVideoAdLoaded";
/**
* Emits after trying to prepare a RewardAd when it could not be loaded
*/
RewardAdPluginEvents["FailedToLoad"] = "onRewardedVideoAdFailedToLoad";
/**
* Emits when the AdReward video is visible to the user
*/
RewardAdPluginEvents["Showed"] = "onRewardedVideoAdShowed";
RewardAdPluginEvents["FailedToShow"] = "onRewardedVideoAdFailedToShow";
/**
* Emits when the AdReward video is not visible to the user anymore.
*
* **Important**: This has nothing to do with the reward it self. This event
* will emits in this two cases:
* 1. The user starts the video ad but close it before the reward emit.
* 2. The user start the video and see it until end, then gets the reward
* and after that the ad is closed.
*/
RewardAdPluginEvents["Dismissed"] = "onRewardedVideoAdDismissed";
RewardAdPluginEvents["Rewarded"] = "onRewardedVideoAdReward";
})(exports.RewardAdPluginEvents || (exports.RewardAdPluginEvents = {}));
const AdMob = core.registerPlugin('AdMob', {

@@ -92,27 +152,33 @@ web: () => Promise.resolve().then(function () { return web; }).then(m => new m.AdMobWeb()),

async initialize() {
console.log();
console.log('initialize');
}
async showBanner(options) {
console.log(options);
console.log('showBanner', options);
}
// Hide the banner, remove it from screen, but can show it later
async hideBanner() {
console.log();
console.log('hideBanner');
}
// Resume the banner, show it after hide
async resumeBanner() {
console.log();
console.log('resumeBanner');
}
// Destroy the banner, remove it from screen.
async removeBanner() {
console.log();
console.log('removeBanner');
}
async prepareInterstitial(options) {
console.log(options);
console.log('prepareInterstitial', options);
return {
adUnitId: options.adId,
};
}
async showInterstitial() {
console.log();
console.log('showInterstitial');
}
async prepareRewardVideoAd(options) {
console.log(options);
return {
adUnitId: options.adId,
};
}

@@ -119,0 +185,0 @@ async showRewardVideoAd() {

var AdMobPlugin = (function (exports, core) {
'use strict';
// This enum should be keep in sync with their native equivalents with the same name
exports.BannerAdPluginEvents = void 0;
(function (BannerAdPluginEvents) {
BannerAdPluginEvents["SizeChanged"] = "bannerAdSizeChanged";
BannerAdPluginEvents["Loaded"] = "bannerAdLoaded";
BannerAdPluginEvents["FailedToLoad"] = "bannerAdFailedToLoad";
/**
* Open or close "Adsense" Event after user click banner
*/
BannerAdPluginEvents["Opened"] = "bannerAdOpened";
BannerAdPluginEvents["Closed"] = "bannerAdClosed";
/**
* Similarly, this method should be called when an impression is recorded for the ad by the mediated SDK.
*/
BannerAdPluginEvents["AdImpression"] = "bannerAdImpression";
})(exports.BannerAdPluginEvents || (exports.BannerAdPluginEvents = {}));
/**
* @see https://developer.android.com/reference/android/widget/LinearLayout#attr_android:gravity
*/
exports.BannerAdPosition = void 0;
(function (BannerAdPosition) {
/**
* Banner position be top-center
*/
BannerAdPosition["TOP_CENTER"] = "TOP_CENTER";
/**
* Banner position be center
*/
BannerAdPosition["CENTER"] = "CENTER";
/**
* Banner position be bottom-center(default)
*/
BannerAdPosition["BOTTOM_CENTER"] = "BOTTOM_CENTER";
})(exports.BannerAdPosition || (exports.BannerAdPosition = {}));
/**
* For more information:
* https://developers.google.com/admob/ios/banner#banner_sizes
* https://developers.google.com/android/reference/com/google/android/gms/ads/AdSize
*
* */
exports.AdSize = void 0;
(function (AdSize) {
exports.BannerAdSize = void 0;
(function (BannerAdSize) {
/**

@@ -15,18 +52,12 @@ * Mobile Marketing Association (MMA)

*/
AdSize["BANNER"] = "BANNER";
BannerAdSize["BANNER"] = "BANNER";
/**
* A dynamically sized banner that matches its parent's
* width and expands/contracts its height to match the ad's
* content after loading completes.
*/
AdSize["FLUID"] = "FLUID";
/**
* Interactive Advertising Bureau (IAB)
* full banner ad size (468x60 density-independent pixels).
*/
AdSize["FULL_BANNER"] = "FULL_BANNER";
BannerAdSize["FULL_BANNER"] = "FULL_BANNER";
/**
* Large banner ad size (320x100 density-independent pixels).
*/
AdSize["LARGE_BANNER"] = "LARGE_BANNER";
BannerAdSize["LARGE_BANNER"] = "LARGE_BANNER";
/**

@@ -36,3 +67,3 @@ * Interactive Advertising Bureau (IAB)

*/
AdSize["LEADERBOARD"] = "LEADERBOARD";
BannerAdSize["LEADERBOARD"] = "LEADERBOARD";
/**

@@ -42,35 +73,64 @@ * Interactive Advertising Bureau (IAB)

*/
AdSize["MEDIUM_RECTANGLE"] = "MEDIUM_RECTANGLE";
BannerAdSize["MEDIUM_RECTANGLE"] = "MEDIUM_RECTANGLE";
/**
* deprecated: A dynamically sized banner that is full-width and auto-height.
* A dynamically sized banner that is full-width and auto-height.
*/
AdSize["SMART_BANNER"] = "SMART_BANNER";
BannerAdSize["ADAPTIVE_BANNER"] = "ADAPTIVE_BANNER";
/**
* A dynamically sized banner that is full-width and auto-height.
* Screen width x 32|50|90
*/
AdSize["ADAPTIVE_BANNER"] = "ADAPTIVE_BANNER";
BannerAdSize["SMART_BANNER"] = "SMART_BANNER";
})(exports.BannerAdSize || (exports.BannerAdSize = {}));
// This enum should be keep in sync with their native equivalents with the same name
exports.InterstitialAdPluginEvents = void 0;
(function (InterstitialAdPluginEvents) {
/**
* To define a custom banner size, set your desired AdSize
* Emits after trying to prepare and Interstitial, when it is loaded and ready to be show
*/
AdSize["CUSTOM"] = "CUSTOM";
})(exports.AdSize || (exports.AdSize = {}));
/**
* @see https://developer.android.com/reference/android/widget/LinearLayout#attr_android:gravity
*/
exports.AdPosition = void 0;
(function (AdPosition) {
InterstitialAdPluginEvents["Loaded"] = "interstitialAdLoaded";
/**
* Banner position be top-center
* Emits after trying to prepare and Interstitial, when it could not be loaded
*/
AdPosition["TOP_CENTER"] = "TOP_CENTER";
InterstitialAdPluginEvents["FailedToLoad"] = "interstitialAdFailedToLoad";
/**
* Banner position be center
* Emits when the Interstitial ad is visible to the user
*/
AdPosition["CENTER"] = "CENTER";
InterstitialAdPluginEvents["Showed"] = "interstitialAdShowed";
InterstitialAdPluginEvents["FailedToShow"] = "interstitialAdFailedToShow";
/**
* Banner position be bottom-center(default)
* Emits when the Interstitial ad is not visible to the user anymore.
*/
AdPosition["BOTTOM_CENTER"] = "BOTTOM_CENTER";
})(exports.AdPosition || (exports.AdPosition = {}));
InterstitialAdPluginEvents["Dismissed"] = "interstitialAdDismissed";
})(exports.InterstitialAdPluginEvents || (exports.InterstitialAdPluginEvents = {}));
// This enum should be keep in sync with their native equivalents with the same name
exports.RewardAdPluginEvents = void 0;
(function (RewardAdPluginEvents) {
/**
* Emits after trying to prepare a RewardAd and the Video is loaded and ready to be show
*/
RewardAdPluginEvents["Loaded"] = "onRewardedVideoAdLoaded";
/**
* Emits after trying to prepare a RewardAd when it could not be loaded
*/
RewardAdPluginEvents["FailedToLoad"] = "onRewardedVideoAdFailedToLoad";
/**
* Emits when the AdReward video is visible to the user
*/
RewardAdPluginEvents["Showed"] = "onRewardedVideoAdShowed";
RewardAdPluginEvents["FailedToShow"] = "onRewardedVideoAdFailedToShow";
/**
* Emits when the AdReward video is not visible to the user anymore.
*
* **Important**: This has nothing to do with the reward it self. This event
* will emits in this two cases:
* 1. The user starts the video ad but close it before the reward emit.
* 2. The user start the video and see it until end, then gets the reward
* and after that the ad is closed.
*/
RewardAdPluginEvents["Dismissed"] = "onRewardedVideoAdDismissed";
RewardAdPluginEvents["Rewarded"] = "onRewardedVideoAdReward";
})(exports.RewardAdPluginEvents || (exports.RewardAdPluginEvents = {}));
const AdMob = core.registerPlugin('AdMob', {

@@ -88,27 +148,33 @@ web: () => Promise.resolve().then(function () { return web; }).then(m => new m.AdMobWeb()),

async initialize() {
console.log();
console.log('initialize');
}
async showBanner(options) {
console.log(options);
console.log('showBanner', options);
}
// Hide the banner, remove it from screen, but can show it later
async hideBanner() {
console.log();
console.log('hideBanner');
}
// Resume the banner, show it after hide
async resumeBanner() {
console.log();
console.log('resumeBanner');
}
// Destroy the banner, remove it from screen.
async removeBanner() {
console.log();
console.log('removeBanner');
}
async prepareInterstitial(options) {
console.log(options);
console.log('prepareInterstitial', options);
return {
adUnitId: options.adId,
};
}
async showInterstitial() {
console.log();
console.log('showInterstitial');
}
async prepareRewardVideoAd(options) {
console.log(options);
return {
adUnitId: options.adId,
};
}

@@ -115,0 +181,0 @@ async showRewardVideoAd() {

{
"name": "@capacitor-community/admob",
"version": "3.0.0-4",
"version": "3.0.0-5",
"description": "A native plugin for AdMob",

@@ -63,3 +63,2 @@ "main": "dist/plugin.cjs.js",

"prettier": "@ionic/prettier-config",
"swiftlint": "@ionic/swiftlint-config",
"eslintConfig": {

@@ -66,0 +65,0 @@ "extends": "@ionic/eslint-config/recommended"

@@ -1,13 +0,20 @@

[![npm version](https://badge.fury.io/js/%40capacitor-community%2Fadmob.svg)](https://badge.fury.io/js/%40capacitor-community%2Fadmob)
<p align="center"><br><img src="https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png" width="128" height="128" /></p>
<h3 align="center">AdMob</h3>
<p align="center"><strong><code>@capacitor-community/admob</code></strong></p>
<p align="center">
Capacitor community plugin for native AdMob.
</p>
<p align="center">
<img src="https://img.shields.io/maintenance/yes/2021?style=flat-square" />
<!-- <a href="https://github.com/capacitor-community/example/actions?query=workflow%3A%22CI%22"><img src="https://img.shields.io/github/workflow/status/capacitor-community/example/CI?style=flat-square" /></a> -->
<a href="https://www.npmjs.com/package/@capacitor-community/admob"><img src="https://img.shields.io/npm/l/@capacitor-community/admob?style=flat-square" /></a>
<br>
<a href="https://www.npmjs.com/package/@capacitor-community/admob"><img src="https://img.shields.io/npm/dw/@capacitor-community/admob?style=flat-square" /></a>
<a href="https://www.npmjs.com/package/@capacitor-community/admob"><img src="https://img.shields.io/npm/v/@capacitor-community/admob?style=flat-square" /></a>
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)
<a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-4-orange?style=flat-square" /></a>
<!-- ALL-CONTRIBUTORS-BADGE:END -->
</p>
# ✅ Please check
This is development README for Capacitor v3. If you use v1 or v2, please check [./README_v2.md](README_v2.md)
# @capacitor-community/admob
Capacitory community plugin for AdMob.
## Maintainers

@@ -35,3 +42,3 @@

```
% npm install --save @capacitor-community/admob@3.0.0-2
% npm install --save @capacitor-community/admob@next
% npx cap update

@@ -89,3 +96,3 @@ ```

```
```ts
initialize(options: { requestTrackingAuthorization?: boolean , testingDevices?: string[]}): Promise<{ value: boolean }>

@@ -101,18 +108,39 @@ ```

### Initialize for @ionic/angular
## APIs
Open our Ionic app **app.component.ts** file and add this following code.
### BANNER
#### Angular
```ts
import { AdMob } from '@capacitor-community/admob';
import { AdMob, AdOptions, AdSize, AdPosition } from '@capacitor-community/admob';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.scss'],
selector: 'admob',
templateUrl: 'admob.component.html',
styleUrls: ['admob.component.scss'],
})
export class AppComponent {
export class AdMobComponent {
private options: AdOptions = {
adId: 'YOUR ADID',
adSize: AdSize.BANNER,
position: AdPosition.BOTTOM_CENTER,
margin: 0,
// isTesting: true
// npa: true
};
constructor() {
// Initialize AdMob for your Application
AdMob.initialize();
// Subscribe Banner Event Listener
AdMob.addListener('bannerViewDidReceiveAd', (info: boolean) => {
console.log('Banner Ad Loaded');
});
// Get Banner Size
AdMob.addListener('bannerViewChangeSize', (info: boolean) => {
console.log(info);
});
// Show Banner Ad
AdMob.showBanner(this.options);
}

@@ -122,4 +150,3 @@ }

### Initialize for @ionic/react
#### React
This is implements simple sample from https://github.com/DavidFrahm . Thanks!

@@ -158,3 +185,3 @@

// Subscribe Banner Event Listener
AdMob.addListener('onAdLoaded', (info: boolean) => {
AdMob.addListener('bannerViewDidReceiveAd', (info: boolean) => {
console.log('Banner ad loaded');

@@ -164,3 +191,3 @@ });

// Get Banner Size
AdMob.addListener('onAdSize', (info: boolean) => {
AdMob.addListener('bannerViewChangeSize', (info: boolean) => {
console.log(info);

@@ -184,64 +211,2 @@ });

## APIs
### BANNER
#### showBanner(options: AdOptions): Promise<{ value: boolean }>
```ts
import { AdMob, AdOptions, AdSize, AdPosition } from '@capacitor-community/admob';
@Component({
selector: 'admob',
templateUrl: 'admob.component.html',
styleUrls: ['admob.component.scss'],
})
export class AdMobComponent {
private options: AdOptions = {
adId: 'YOUR ADID',
adSize: AdSize.BANNER,
position: AdPosition.BOTTOM_CENTER,
margin: 0,
// isTesting: true
// npa: true
};
constructor() {
// Show Banner Ad
AdMob.showBanner(this.options);
// Subscribe Banner Event Listener
AdMob.addListener('bannerViewDidReceiveAd', (info: boolean) => {
console.log('Banner Ad Loaded');
});
// Get Banner Size
AdMob.addListener('bannerViewChangeSize', (info: boolean) => {
console.log(info);
});
}
}
```
#### hideBanner(): Promise<{ value: boolean }>
```ts
// Hide the banner, remove it from screen, but can show it later
AdMob.hideBanner();
```
#### resumeBanner(): Promise<{ value: boolean }>
```ts
// Resume the banner, show it after hide
AdMob.resumeBanner();
```
#### removeBanner(): Promise<{ value: boolean }>
```ts
// Destroy the banner, remove it from screen.
AdMob.removeBanner();
```
### INTERSTITIAL

@@ -264,3 +229,3 @@

// Subscribe interstitial Event Listener
AdMob.addListener('onInterstitialAdLoaded', (info: boolean) => {
AdMob.addListener('adDidPresentFullScreenContent', (info: boolean) => {
AdMob.showInterstitial();

@@ -291,3 +256,3 @@ });

constructor() {
AdMob.addListener('onRewardedVideoAdLoaded', () => {
AdMob.addListener('adDidPresentFullScreenContent', () => {
AdMob.showRewardVideoAd();

@@ -304,22 +269,3 @@ });

* [`initialize(...)`](#initialize)
* [`showBanner(...)`](#showbanner)
* [`hideBanner()`](#hidebanner)
* [`resumeBanner()`](#resumebanner)
* [`removeBanner()`](#removebanner)
* [`prepareInterstitial(...)`](#prepareinterstitial)
* [`showInterstitial()`](#showinterstitial)
* [`prepareRewardVideoAd(...)`](#preparerewardvideoad)
* [`showRewardVideoAd()`](#showrewardvideoad)
* [`addListener(...)`](#addlistener)
* [`addListener(...)`](#addlistener)
* [`addListener(...)`](#addlistener)
* [`addListener(...)`](#addlistener)
* [`addListener(...)`](#addlistener)
* [`addListener(...)`](#addlistener)
* [`addListener(...)`](#addlistener)
* [`addListener(...)`](#addlistener)
* [`addListener(...)`](#addlistener)
* [`addListener(...)`](#addlistener)
* [Interfaces](#interfaces)
* [Enums](#enums)

@@ -349,318 +295,2 @@ </docgen-index>

### showBanner(...)
```typescript
showBanner(options: AdOptions) => Promise<void>
```
Show a banner Ad
| Param | Type | Description |
| ------------- | ----------------------------------------------- | ---------------------------------- |
| **`options`** | <code><a href="#adoptions">AdOptions</a></code> | <a href="#adoptions">AdOptions</a> |
**Since:** 1.1.2
--------------------
### hideBanner()
```typescript
hideBanner() => Promise<void>
```
Hide the banner, remove it from screen, but can show it later
**Since:** 1.1.2
--------------------
### resumeBanner()
```typescript
resumeBanner() => Promise<void>
```
Resume the banner, show it after hide
**Since:** 1.1.2
--------------------
### removeBanner()
```typescript
removeBanner() => Promise<void>
```
Destroy the banner, remove it from screen.
**Since:** 1.1.2
--------------------
### prepareInterstitial(...)
```typescript
prepareInterstitial(options: AdOptions) => Promise<void>
```
Prepare interstitial banner
| Param | Type | Description |
| ------------- | ----------------------------------------------- | ---------------------------------- |
| **`options`** | <code><a href="#adoptions">AdOptions</a></code> | <a href="#adoptions">AdOptions</a> |
**Since:** 1.1.2
--------------------
### showInterstitial()
```typescript
showInterstitial() => Promise<void>
```
Show interstitial ad when it’s ready
**Since:** 1.1.2
--------------------
### prepareRewardVideoAd(...)
```typescript
prepareRewardVideoAd(options: AdOptions) => Promise<void>
```
Prepare a reward video ad
| Param | Type | Description |
| ------------- | ----------------------------------------------- | ---------------------------------- |
| **`options`** | <code><a href="#adoptions">AdOptions</a></code> | <a href="#adoptions">AdOptions</a> |
**Since:** 1.1.2
--------------------
### showRewardVideoAd()
```typescript
showRewardVideoAd() => Promise<AdMobRewardItem>
```
Show a reward video ad
**Returns:** <code>Promise&lt;<a href="#admobrewarditem">AdMobRewardItem</a>&gt;</code>
**Since:** 1.1.2
--------------------
### addListener(...)
```typescript
addListener(eventName: 'bannerViewChangeSize', listenerFunc: (info: AdMobBannerSize) => void) => PluginListenerHandle
```
| Param | Type | Description |
| ------------------ | ------------------------------------------------------------------------------ | -------------------- |
| **`eventName`** | <code>"bannerViewChangeSize"</code> | bannerViewChangeSize |
| **`listenerFunc`** | <code>(info: <a href="#admobbannersize">AdMobBannerSize</a>) =&gt; void</code> | |
**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
**Since:** 3.0.0
--------------------
### addListener(...)
```typescript
addListener(eventName: 'bannerViewDidReceiveAd', listenerFunc: () => void) => PluginListenerHandle
```
Notice: request loaded Banner ad
| Param | Type | Description |
| ------------------ | ------------------------------------- | ---------------------- |
| **`eventName`** | <code>"bannerViewDidReceiveAd"</code> | bannerViewDidReceiveAd |
| **`listenerFunc`** | <code>() =&gt; void</code> | |
**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
**Since:** 3.0.0
--------------------
### addListener(...)
```typescript
addListener(eventName: 'bannerView:didFailToReceiveAdWithError', listenerFunc: (info: AdMobError) => void) => PluginListenerHandle
```
Notice: request failed Banner ad
| Param | Type | Description |
| ------------------ | -------------------------------------------------------------------- | -------------------------------------- |
| **`eventName`** | <code>"bannerView:didFailToReceiveAdWithError"</code> | bannerView:didFailToReceiveAdWithError |
| **`listenerFunc`** | <code>(info: <a href="#admoberror">AdMobError</a>) =&gt; void</code> | |
**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
**Since:** 3.0.0
--------------------
### addListener(...)
```typescript
addListener(eventName: 'bannerViewWillPresentScreen', listenerFunc: (info: any) => void) => PluginListenerHandle
```
Notice: full-screen banner view will be presented in response to the user clicking on an ad.
| Param | Type | Description |
| ------------------ | ------------------------------------------ | --------------------------- |
| **`eventName`** | <code>"bannerViewWillPresentScreen"</code> | bannerViewWillPresentScreen |
| **`listenerFunc`** | <code>(info: any) =&gt; void</code> | |
**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
**Since:** 3.0.0
--------------------
### addListener(...)
```typescript
addListener(eventName: 'bannerViewWillDismissScreen', listenerFunc: (info: any) => void) => PluginListenerHandle
```
Notice: The full-screen banner view will be dismissed.
| Param | Type | Description |
| ------------------ | ------------------------------------------ | --------------------------- |
| **`eventName`** | <code>"bannerViewWillDismissScreen"</code> | bannerViewWillDismissScreen |
| **`listenerFunc`** | <code>(info: any) =&gt; void</code> | |
**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
**Since:** 3.0.0
--------------------
### addListener(...)
```typescript
addListener(eventName: 'bannerViewWillDismissScreen', listenerFunc: (info: any) => void) => PluginListenerHandle
```
Notice: The full-screen banner view will been dismissed.
| Param | Type | Description |
| ------------------ | ------------------------------------------ | --------------------------- |
| **`eventName`** | <code>"bannerViewWillDismissScreen"</code> | bannerViewWillDismissScreen |
| **`listenerFunc`** | <code>(info: any) =&gt; void</code> | |
**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
**Since:** 3.0.0
--------------------
### addListener(...)
```typescript
addListener(eventName: 'bannerViewDidDismissScreen', listenerFunc: (info: any) => void) => PluginListenerHandle
```
Notice: The full-screen banner view has been dismissed.
| Param | Type | Description |
| ------------------ | ----------------------------------------- | -------------------------- |
| **`eventName`** | <code>"bannerViewDidDismissScreen"</code> | bannerViewDidDismissScreen |
| **`listenerFunc`** | <code>(info: any) =&gt; void</code> | |
**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
**Since:** 3.0.0
--------------------
### addListener(...)
```typescript
addListener(eventName: 'adDidPresentFullScreenContent', listenerFunc: (info: any) => void) => PluginListenerHandle
```
Notice: Interstitial ad opened
| Param | Type | Description |
| ------------------ | -------------------------------------------- | ----------------------------- |
| **`eventName`** | <code>"adDidPresentFullScreenContent"</code> | adDidPresentFullScreenContent |
| **`listenerFunc`** | <code>(info: any) =&gt; void</code> | |
**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
**Since:** 3.0.0
--------------------
### addListener(...)
```typescript
addListener(eventName: 'adDidDismissFullScreenContent', listenerFunc: (info: any) => void) => PluginListenerHandle
```
Notice: Dismiss Content
| Param | Type | Description |
| ------------------ | -------------------------------------------- | ----------------------------- |
| **`eventName`** | <code>"adDidDismissFullScreenContent"</code> | adDidDismissFullScreenContent |
| **`listenerFunc`** | <code>(info: any) =&gt; void</code> | |
**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
**Since:** 3.0.0
--------------------
### addListener(...)
```typescript
addListener(eventName: 'didFailToPresentFullScreenContentWithError', listenerFunc: (info: AdMobError) => void) => PluginListenerHandle
```
Notice: Interstitial ad is be failed to open
| Param | Type | Description |
| ------------------ | -------------------------------------------------------------------- | ------------------------------------------ |
| **`eventName`** | <code>"didFailToPresentFullScreenContentWithError"</code> | didFailToPresentFullScreenContentWithError |
| **`listenerFunc`** | <code>(info: <a href="#admoberror">AdMobError</a>) =&gt; void</code> | |
**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
**Since:** 3.0.0
--------------------
### Interfaces

@@ -677,82 +307,2 @@

#### AdOptions
| Prop | Type | Description | Default | Since |
| --------------- | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- | ----- |
| **`adId`** | <code>string</code> | The ad unit ID that you want to request | | 1.1.2 |
| **`adSize`** | <code><a href="#adsize">AdSize</a></code> | Banner Ad Size, defaults to SMART_BANNER. IT can be: SMART_BANNER, BANNER, MEDIUM_RECTANGLE, FULL_BANNER, LEADERBOARD, SKYSCRAPER, or CUSTOM | <code>SMART_BANNER</code> | 1.1.2 |
| **`position`** | <code><a href="#adposition">AdPosition</a></code> | Set Banner Ad position. TOP_CENTER or CENTER or BOTTOM_CENTER | <code>TOP_CENTER</code> | 1.1.2 |
| **`isTesting`** | <code>boolean</code> | You can use test mode of ad. | <code>false</code> | 1.1.2 |
| **`margin`** | <code>number</code> | Margin Banner. Default is 0px; If position is BOTTOM_CENTER, margin is be margin-bottom. If position is TOP_CENTER, margin is be margin-top. | <code>0</code> | 1.1.2 |
| **`npa`** | <code>boolean</code> | The default behavior of the Google Mobile Ads SDK is to serve personalized ads. Set this to true to request Non-Personalized Ads | <code>false</code> | 1.2.0 |
#### AdMobRewardItem
For more information
https://developers.google.com/admob/android/rewarded-video-adapters?hl=en
| Prop | Type | Description |
| ------------ | ------------------- | ------------------------ |
| **`type`** | <code>string</code> | Rewarded type user got |
| **`amount`** | <code>number</code> | Rewarded amount user got |
#### PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |
#### AdMobBannerSize
When notice listener of OnAdLoaded, you can get banner size.
| Prop | Type |
| ------------ | ------------------- |
| **`width`** | <code>number</code> |
| **`height`** | <code>number</code> |
#### AdMobError
For more information
https://developers.google.com/android/reference/com/google/android/gms/ads/AdError
| Prop | Type | Description |
| ------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **`code`** | <code>number</code> | Gets the error's code. |
| **`message`** | <code>string</code> | Gets the message describing the error. |
| **`cause`** | <code>string</code> | Gets the cause of this error or null if the cause is nonexistent or unknown. |
| **`domain`** | <code>string</code> | Gets the domain of the error. MobileAds.ERROR_DOMAIN for Google Mobile Ads SDK errors, or a domain defined by mediation networks for mediation errors. |
### Enums
#### AdSize
| Members | Value | Description |
| ---------------------- | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| **`BANNER`** | <code>'BANNER'</code> | Mobile Marketing Association (MMA) banner ad size (320x50 density-independent pixels). |
| **`FLUID`** | <code>'FLUID'</code> | A dynamically sized banner that matches its parent's width and expands/contracts its height to match the ad's content after loading completes. |
| **`FULL_BANNER`** | <code>'FULL_BANNER'</code> | Interactive Advertising Bureau (IAB) full banner ad size (468x60 density-independent pixels). |
| **`LARGE_BANNER`** | <code>'LARGE_BANNER'</code> | Large banner ad size (320x100 density-independent pixels). |
| **`LEADERBOARD`** | <code>'LEADERBOARD'</code> | Interactive Advertising Bureau (IAB) leaderboard ad size (728x90 density-independent pixels). |
| **`MEDIUM_RECTANGLE`** | <code>'MEDIUM_RECTANGLE'</code> | Interactive Advertising Bureau (IAB) medium rectangle ad size (300x250 density-independent pixels). |
| **`SMART_BANNER`** | <code>'SMART_BANNER'</code> | deprecated: A dynamically sized banner that is full-width and auto-height. |
| **`ADAPTIVE_BANNER`** | <code>'ADAPTIVE_BANNER'</code> | A dynamically sized banner that is full-width and auto-height. |
| **`CUSTOM`** | <code>'CUSTOM'</code> | To define a custom banner size, set your desired <a href="#adsize">AdSize</a> |
#### AdPosition
| Members | Value | Description |
| ------------------- | ---------------------------- | ----------------------------------------- |
| **`TOP_CENTER`** | <code>'TOP_CENTER'</code> | Banner position be top-center |
| **`CENTER`** | <code>'CENTER'</code> | Banner position be center |
| **`BOTTOM_CENTER`** | <code>'BOTTOM_CENTER'</code> | Banner position be bottom-center(default) |
</docgen-api>

@@ -759,0 +309,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc