1 | import { Observable } from 'rxjs/Observable';
|
2 | export declare type AdMobAdSize = 'SMART_BANNER' | 'BANNER' | 'MEDIUM_RECTANGLE' | 'FULL_BANNER' | 'LEADERBOARD' | 'SKYSCRAPER' | 'CUSTOM';
|
3 | export interface AdMobOptions {
|
4 | /**
|
5 | * Banner ad ID
|
6 | */
|
7 | adId?: string;
|
8 | /**
|
9 | * Banner Ad Size, defaults to `SMART_BANNER`. IT can be: `SMART_BANNER`, `BANNER`, `MEDIUM_RECTANGLE`, `FULL_BANNER`, `LEADERBOARD`, `SKYSCRAPER`, or `CUSTOM`
|
10 | */
|
11 | adSize?: AdMobAdSize;
|
12 | /**
|
13 | * Banner width, valid when `adSize` is set to `CUSTOM`
|
14 | */
|
15 | width?: number;
|
16 | /**
|
17 | * Banner height, valid when `adSize` is set to `CUSTOM`
|
18 | */
|
19 | height?: number;
|
20 | /**
|
21 | * Allow banner to overlap webview, or else it will push webview up or down to avoid overlap. Defaults to false.
|
22 | */
|
23 | overlap?: boolean;
|
24 | /**
|
25 | * Position of banner ad. Defaults to `TOP_CENTER`. You can use the `AdMob.AD_POSITION` property to select other values.
|
26 | */
|
27 | position?: number;
|
28 | /**
|
29 | * X in pixels. Valid when `position` is set to `POS_XY`
|
30 | */
|
31 | x?: number;
|
32 | /**
|
33 | * Y in pixels. Valid when `position` is set to `POS_XY`
|
34 | */
|
35 | y?: number;
|
36 | /**
|
37 | * Set to true to receive test ad for testing purposes
|
38 | */
|
39 | isTesting?: boolean;
|
40 | /**
|
41 | * Auto show interstitial ad when loaded. Set to false if hope to control the show timing with prepareInterstitial/showInterstitial
|
42 | */
|
43 | autoShow?: boolean;
|
44 | /**
|
45 | * Re-create the banner on web view orientation change (not screen orientation), or else just move the banner. Default:true.
|
46 | */
|
47 | orientationRenew?: boolean;
|
48 | /**
|
49 | * Set extra color style for Ad
|
50 | */
|
51 | adExtras?: AdMobAdExtras;
|
52 | }
|
53 | export interface AdMobAdExtras {
|
54 | color_bg: string;
|
55 | color_bg_top: string;
|
56 | color_border: string;
|
57 | color_link: string;
|
58 | color_text: string;
|
59 | color_url: string;
|
60 | }
|
61 | /**
|
62 | * @name AdMob
|
63 | * @description
|
64 | * Plugin for Google Ads, including AdMob / DFP (doubleclick for publisher) and mediations to other Ad networks.
|
65 | * @usage
|
66 | * ```typescript
|
67 | * import { AdMob } from 'ionic-native';
|
68 | *
|
69 | * ionViewDidLoad() {
|
70 | * AdMob.onAdDismiss()
|
71 | * .subscribe(() => { console.log('User dismissed ad'); });
|
72 | * }
|
73 | *
|
74 | * onClick() {
|
75 | * AdMob.prepareInterstitial('YOUR_ADID')
|
76 | * .then(() => { AdMob.showInterstitial(); });
|
77 | * }
|
78 | *
|
79 | * ```
|
80 | *
|
81 | * @interfaces
|
82 | * AdMobOptions
|
83 | * AdMobAdExtras
|
84 | */
|
85 | export declare class AdMob {
|
86 | /**
|
87 | * @private
|
88 | */
|
89 | static AD_POSITION: {
|
90 | NO_CHANGE: number;
|
91 | TOP_LEFT: number;
|
92 | TOP_CENTER: number;
|
93 | TOP_RIGHT: number;
|
94 | LEFT: number;
|
95 | CENTER: number;
|
96 | RIGHT: number;
|
97 | BOTTOM_LEFT: number;
|
98 | BOTTOM_CENTER: number;
|
99 | BOTTOM_RIGHT: number;
|
100 | POS_XY: number;
|
101 | };
|
102 | /**
|
103 | * Create a banner
|
104 | * @param adIdOrOptions {string | AdMobOptions} Ad ID or Options
|
105 | * @returns {Promise<any>} Returns a Promise that resolves when the banner is created
|
106 | */
|
107 | static createBanner(adIdOrOptions: string | AdMobOptions): Promise<any>;
|
108 | /**
|
109 | * Destroy the banner, remove it from screen.
|
110 | */
|
111 | static removeBanner(): void;
|
112 | /**
|
113 | * Show banner at position
|
114 | * @param position {number} Position. Use `AdMob.AD_POSITION` to set values.
|
115 | */
|
116 | static showBanner(position: number): void;
|
117 | /**
|
118 | * Show banner at custom position
|
119 | * @param x {number} Offset from screen left.
|
120 | * @param y {number} Offset from screen top.
|
121 | */
|
122 | static showBannerAtXY(x: number, y: number): void;
|
123 | /**
|
124 | * Hide the banner, remove it from screen, but can show it later
|
125 | */
|
126 | static hideBanner(): void;
|
127 | /**
|
128 | * Prepare interstitial banner
|
129 | * @param adIdOrOptions {string | AdMobOptions} Ad ID or Options
|
130 | * @returns {Promise<any>} Returns a Promise that resolves when interstitial is prepared
|
131 | */
|
132 | static prepareInterstitial(adIdOrOptions: string | AdMobOptions): Promise<any>;
|
133 | /**
|
134 | * Show interstitial ad when it's ready
|
135 | */
|
136 | static showInterstitial(): void;
|
137 | /**
|
138 | * Prepare a reward video ad
|
139 | * @param adIdOrOptions {string | AdMobOptions} Ad ID or Options
|
140 | * @returns {Promise<any>} Returns a Promise that resolves when the ad is prepared
|
141 | */
|
142 | static prepareRewardVideoAd(adIdOrOptions: string | AdMobOptions): Promise<any>;
|
143 | /**
|
144 | * Show a reward video ad
|
145 | */
|
146 | static showRewardVideoAd(): void;
|
147 | /**
|
148 | * Sets the values for configuration and targeting
|
149 | * @param options {AdMobOptions} Options
|
150 | * @returns {Promise<any>} Returns a Promise that resolves when the options have been set
|
151 | */
|
152 | static setOptions(options: AdMobOptions): Promise<any>;
|
153 | /**
|
154 | * Get user ad settings
|
155 | * @returns {Promise<any>} Returns a promise that resolves with the ad settings
|
156 | */
|
157 | static getAdSettings(): Promise<any>;
|
158 | /**
|
159 | * Triggered when failed to receive Ad
|
160 | * @returns {Observable<any>}
|
161 | */
|
162 | static onAdFailLoad(): Observable<any>;
|
163 | /**
|
164 | * Triggered when Ad received
|
165 | * @returns {Observable<any>}
|
166 | */
|
167 | static onAdLoaded(): Observable<any>;
|
168 | /**
|
169 | * Triggered when Ad will be showed on screen
|
170 | * @returns {Observable<any>}
|
171 | */
|
172 | static onAdPresent(): Observable<any>;
|
173 | /**
|
174 | * Triggered when user click the Ad, and will jump out of your App
|
175 | * @returns {Observable<any>}
|
176 | */
|
177 | static onAdLeaveApp(): Observable<any>;
|
178 | /**
|
179 | * Triggered when dismiss the Ad and back to your App
|
180 | * @returns {Observable<any>}
|
181 | */
|
182 | static onAdDismiss(): Observable<any>;
|
183 | }
|