This repository was archived by the owner on Apr 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 431
Expand file tree
/
Copy pathadmob.d.ts
More file actions
209 lines (177 loc) · 5.76 KB
/
admob.d.ts
File metadata and controls
209 lines (177 loc) · 5.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/**
* The allowed values for AD_SIZE.
*/
export enum AD_SIZE {
SMART_BANNER,
LARGE_BANNER,
BANNER,
MEDIUM_RECTANGLE,
FULL_BANNER,
LEADERBOARD,
SKYSCRAPER,
FLUID
}
/**
* The possible error codes (see https://developers.google.com/android/reference/com/google/android/gms/ads/AdRequest#ERROR_CODE_INTERNAL_ERROR).
* TODO seems like we're not using these at the moment.
*/
export enum ERROR_CODES {
ERROR_CODE_INTERNAL_ERROR,
ERROR_CODE_INVALID_REQUEST,
ERROR_CODE_NETWORK_ERROR,
ERROR_CODE_NO_FILL
}
interface AdLifeCycleEvents {
/**
* Called when the user is about to return to the application after clicking on an ad.
* For all callbacks, see https://developers.google.com/android/reference/com/google/android/gms/ads/AdListener
*/
onClosed?: () => void;
/**
* @Deprecated please use onClosed instead. Simply remove these two letters: 'Ad'.
*/
onAdClosed?: () => void;
/**
* Called when a click is recorded for an ad.
*/
onClicked?: () => void;
/**
* Called when an ad opens an overlay that covers the screen.
*/
onOpened?: () => void;
/**
* Called when an ad leaves the application (e.g., to go to the browser).
*/
onLeftApplication?: () => void;
}
export interface BannerOptions extends AdLifeCycleEvents {
/**
* The layout of the banner.
* Default AD_SIZE.SMART_BANNER
*/
size?: AD_SIZE;
/**
* When false (default) you'll get real banners.
*/
testing?: boolean;
/**
* Something like "ca-app-pub-AAAAAAAA/BBBBBBB".
*/
androidBannerId?: string;
/**
* Something like "ca-app-pub-XXXXXX/YYYYYY".
*/
iosBannerId?: string;
/**
* If testing is true, the simulator is allowed to receive test banners.
* Android automatically add the connceted device as test device, but iOS does not.
* If you also want to test on real devices, add it here like this:
* ["ce97330130c9047ce0d4430d37d713b1", ".."]
*/
iosTestDeviceIds?: string[];
/**
* The number of pixels from the top/bottom of the view.
* The plugin corrects for display density, so don't worry about that.
*
* If both are set, top wins.
*/
margins?: {
/**
* Default: -1 (ignored).
*/
top?: number;
/**
* Default: -1 (ignored).
*/
bottom?: number;
};
/**
* Specify keywords for ad targeting
*/
keywords?: string[];
}
export interface InterstitialOptions extends AdLifeCycleEvents {
/**
* When false (default) you'll get real banners.
*/
testing?: boolean;
/**
* Something like "ca-app-pub-AAAAAAAA/BBBBBBB".
*/
androidInterstitialId?: string;
/**
* Something like "ca-app-pub-XXXXXX/YYYYYY".
*/
iosInterstitialId?: string;
/**
* If testing is true, the simulator is allowed to receive test banners.
* Android automatically add the connceted device as test device, but iOS does not.
* If you also want to test on real devices, add it here like this:
* ["ce97330130c9047ce0d4430d37d713b1", ".."]
*/
iosTestDeviceIds?: string[];
}
export interface PreloadRewardedVideoAdOptions {
/**
* for user_id of https://developers.google.com/admob/ios/ssv#ssv_callback_parameters or https://developers.google.com/admob/android/ssv#ssv_callback_parameters
*/
userId?:string;
/**
* for custom_data of https://developers.google.com/admob/ios/ssv#ssv_callback_parameters or https://developers.google.com/admob/android/ssv#ssv_callback_parameters
*/
customData?:string;
/**
* When true you'll use googles testing iosAdPlacementId and androidAdPlacementId.
*/
testing?: boolean;
/**
* Something like "ca-app-pub-AAAAAAAA/BBBBBBB".
*/
androidAdPlacementId?: string;
/**
* Something like "ca-app-pub-XXXXXX/YYYYYY".
*/
iosAdPlacementId?: string;
/**
* If testing is true, the simulator is allowed to receive test banners.
* Android automatically add the connceted device as test device, but iOS does not.
* If you also want to test on real devices, add it here like this:
* ["ce97330130c9047ce0d4430d37d713b1", ".."]
*/
iosTestDeviceIds?: string[];
/**
* Specify keywords for ad targeting
*/
keywords?: Array<string>;
}
export interface RewardedVideoAdReward {
amount: number;
type: string;
}
export interface RewardedVideoAdCallbacks extends AdLifeCycleEvents {
onStarted?: () => void;
onCompleted?: () => void;
onLoaded?: () => void,
onFailedToLoad?: (err) => void,
onRewarded?: (reward: RewardedVideoAdReward) => void;
}
export interface ShowRewardedVideoAdOptions extends RewardedVideoAdCallbacks {
}
export declare function showBanner(options: BannerOptions): Promise<any>;
export declare function hideBanner(): Promise<any>;
/**
* To show a fullscreen banner you can use this function.
* Note that Interstitial banners need to be loaded before they can be shown,
* so use this function, and when the promise resolves you can call 'showInterstitial'.
* If you don't want to use 2 steps, use showInterstitial (with the same arguments) instead,
* but there will be a (preloading) delay which is not recommended.
*/
export declare function preloadInterstitial(options: InterstitialOptions): Promise<any>;
/**
* There's two ways how you can use this:
* 1) RECOMMENDED: without arguments, and after the Promise of 'preloadInterstitial' resolves. This will show the interstitial immediately.
* 2) DEPRECATED: with arguments (same as 'preloadInterstitial'). This will preload and _then_ show the interstitial, so a delay will be noticable by the user, which is against Google's policies.
*/
export declare function showInterstitial(options?: InterstitialOptions): Promise<any>;
export declare function preloadRewardedVideoAd(options: PreloadRewardedVideoAdOptions): Promise<any>;
export declare function showRewardedVideoAd(options?: ShowRewardedVideoAdOptions): Promise<any>;