emi-indo-cordova-plugin-admob 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -3
- package/example/index.html +7 -0
- package/package.json +1 -1
- package/plugin.xml +1 -1
- package/src/ios/emiAdmobPlugin.swift +35 -7
package/README.md
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
# emi-indo-cordova-plugin-admob
|
2
|
-
Cordova Plugin Admob Android
|
2
|
+
Cordova Plugin Admob Android and IOS
|
3
|
+
|
4
|
+
### Mobile Ads SDK (Android: 22.0.0) [Release Notes:](https://developers.google.com/admob/android/rel-notes)
|
5
|
+
|
6
|
+
### Mobile Ads SDK (IOS: 10.3.0) [Release Notes:](https://developers.google.com/admob/ios/rel-notes)
|
7
|
+
|
8
|
+
### [Documentation for IOS](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/discussions/3)
|
9
|
+
|
10
|
+
-
|
3
11
|
|
4
|
-
### Mobile Ads SDK (Android: 22.0.0)
|
5
|
-
[Release Notes:](https://developers.google.com/admob/android/rel-notes)
|
6
12
|
|
7
13
|
> __Warning__
|
8
14
|
> Updating the Mobile Ads SDK version may cause some code to malfunction, as the latest version usually deprecates some older code, [scrrenshot](https://drive.google.com/file/d/1UKaEjdmGRXgdZ2DKfOne8BSq13IUY14_/view) Current plugin code SDK 22.0.0
|
@@ -133,6 +139,7 @@ alert("on Sdk Initialization Complete");
|
|
133
139
|
- position | index 1
|
134
140
|
- size | index 2
|
135
141
|
- adaptiveWidth | index 3
|
142
|
+
- npa | index 4
|
136
143
|
|
137
144
|
|
138
145
|
```sh
|
@@ -149,6 +156,7 @@ let showBannerAdaptive = () => {
|
|
149
156
|
position = "bottom-center",
|
150
157
|
size = "Inline_adaptive", // | Inline_adaptive | Anchored_adaptive
|
151
158
|
adaptiveWidth = 320,
|
159
|
+
npa = "1", // String | 0 | 1
|
152
160
|
|
153
161
|
(seccess) => { console.log("success") },
|
154
162
|
(error) => { alert(error)
|
@@ -165,6 +173,7 @@ let showBannerNotAdaptive = () => {
|
|
165
173
|
bannerAdUnitId = "ca-app-pub-3940256099942544/6300978111",
|
166
174
|
position = "bottom-center",
|
167
175
|
size = "BANNER",
|
176
|
+
npa = "1", // String | 0 | 1
|
168
177
|
|
169
178
|
(seccess) => { console.log("success") },
|
170
179
|
(error) => { alert(error)
|
@@ -192,6 +201,7 @@ let removeBannerAd = () => {
|
|
192
201
|
### Variable name and index (final) cannot be changed.
|
193
202
|
- interstitialAdAdUnitId | index 0
|
194
203
|
- responseInfo | index 1
|
204
|
+
- npa | index 2
|
195
205
|
|
196
206
|
```sh
|
197
207
|
// Load Interstitial Ad
|
@@ -200,6 +210,7 @@ let loadInterstitialAd = () => {
|
|
200
210
|
cordova.plugins.emiAdmobPlugin.loadInterstitialAd(
|
201
211
|
interstitialAdAdUnitId = "ca-app-pub-3940256099942544/1033173712",
|
202
212
|
responseInfo = true, // boolean (debugging)
|
213
|
+
npa = "1", // String | 0 | 1
|
203
214
|
|
204
215
|
(info) => { alert(info) },
|
205
216
|
(error) => { alert(error)
|
@@ -229,6 +240,7 @@ let showInterstitialAd = () => {
|
|
229
240
|
### Variable name and index (final) cannot be changed.
|
230
241
|
- rewardedAdAdUnitId | index 0
|
231
242
|
- responseInfo | index 1
|
243
|
+
- npa | index 2
|
232
244
|
|
233
245
|
```sh
|
234
246
|
|
@@ -238,6 +250,7 @@ let loadRewardedAd = () => {
|
|
238
250
|
cordova.plugins.emiAdmobPlugin.loadRewardedAd(
|
239
251
|
rewardedAdAdUnitId = "ca-app-pub-3940256099942544/5224354917",
|
240
252
|
responseInfo = true, // boolean (debugging)
|
253
|
+
npa = "1", // String | 0 | 1
|
241
254
|
|
242
255
|
|
243
256
|
(info) => { alert(info) },
|
@@ -268,6 +281,7 @@ let showRewardedAd = () => {
|
|
268
281
|
### Variable name and index (final) cannot be changed.
|
269
282
|
- rewardedInterstitialAdUnitId | index 0
|
270
283
|
- responseInfo | index 1
|
284
|
+
- npa | index 2
|
271
285
|
|
272
286
|
```sh
|
273
287
|
|
@@ -277,6 +291,7 @@ let loadRewardedInterstitialAd = () => {
|
|
277
291
|
cordova.plugins.emiAdmobPlugin.loadRewardedInterstitialAd(
|
278
292
|
rewardedInterstitialAdUnitId = "ca-app-pub-3940256099942544/5354046379",
|
279
293
|
responseInfo = true, // boolean (debugging)
|
294
|
+
npa = "1", // String | 0 | 1
|
280
295
|
|
281
296
|
(info) => { alert(info) },
|
282
297
|
(error) => { alert(error)
|
@@ -394,6 +409,7 @@ alert("on.banner Ad Loaded");
|
|
394
409
|
- on.rewardedAdFailedToShowFullScreenContent
|
395
410
|
- on.rewardedAdImpression
|
396
411
|
- on.rewardedAdShowedFullScreenContent
|
412
|
+
- on.rewarded.rewarded
|
397
413
|
|
398
414
|
|
399
415
|
|
@@ -412,6 +428,10 @@ alert("on.banner Ad Loaded");
|
|
412
428
|
- on.rewardedInterstitialAdFailedToShowFullScreenContent
|
413
429
|
- on.rewardedInterstitialAdImpression
|
414
430
|
- on.rewardedInterstitialAdShowedFullScreenContent
|
431
|
+
- on.rewardedInterstitial.rewarded
|
432
|
+
|
433
|
+
|
434
|
+
|
415
435
|
|
416
436
|
|
417
437
|
# Admob Mediation
|
@@ -541,6 +561,7 @@ emi-indo-cordova-plugin-admob@0.0.5
|
|
541
561
|
|
542
562
|
### Platform Support
|
543
563
|
- Android
|
564
|
+
- IOS
|
544
565
|
|
545
566
|
|
546
567
|
## 💰Sponsor this project
|
package/example/index.html
CHANGED
@@ -20,6 +20,7 @@ let showBannerAdaptive = () => {
|
|
20
20
|
position = "bottom-center",
|
21
21
|
size = "Inline_adaptive", // | Inline_adaptive | Anchored_adaptive
|
22
22
|
adaptiveWidth = 320,
|
23
|
+
npa = "1", // String | 0 | 1
|
23
24
|
|
24
25
|
(seccess) => { console.log("success") },
|
25
26
|
(error) => { alert(error)
|
@@ -34,6 +35,7 @@ let showBannerNotAdaptive = () => {
|
|
34
35
|
bannerAdUnitId = "ca-app-pub-3940256099942544/6300978111",
|
35
36
|
position = "bottom-center",
|
36
37
|
size = "BANNER",
|
38
|
+
npa = "1", // String | 0 | 1
|
37
39
|
|
38
40
|
(seccess) => { console.log("success") },
|
39
41
|
(error) => { alert(error)
|
@@ -54,6 +56,7 @@ let loadInterstitialAd = () => {
|
|
54
56
|
cordova.plugins.emiAdmobPlugin.loadInterstitialAd(
|
55
57
|
interstitialAdAdUnitId = "ca-app-pub-3940256099942544/1033173712",
|
56
58
|
responseInfo = true, // boolean
|
59
|
+
npa = "1", // String | 0 | 1
|
57
60
|
|
58
61
|
(info) => { alert(info) },
|
59
62
|
(error) => { alert(error)
|
@@ -73,6 +76,7 @@ let loadRewardedInterstitialAd = () => {
|
|
73
76
|
cordova.plugins.emiAdmobPlugin.loadRewardedInterstitialAd(
|
74
77
|
rewardedInterstitialAdUnitId = "ca-app-pub-3940256099942544/5354046379",
|
75
78
|
responseInfo = true, // boolean
|
79
|
+
npa = "1", // String | 0 | 1
|
76
80
|
|
77
81
|
(info) => { alert(info) },
|
78
82
|
(error) => { alert(error)
|
@@ -93,6 +97,7 @@ let loadRewardedAd = () => {
|
|
93
97
|
cordova.plugins.emiAdmobPlugin.loadRewardedAd(
|
94
98
|
rewardedAdAdUnitId = "ca-app-pub-3940256099942544/5224354917",
|
95
99
|
responseInfo = true, // boolean
|
100
|
+
npa = "1", // String | 0 | 1
|
96
101
|
|
97
102
|
|
98
103
|
(info) => { alert(info) },
|
@@ -171,6 +176,7 @@ on.rewardedInterstitialAdDismissedFullScreenContent
|
|
171
176
|
on.rewardedInterstitialAdFailedToShowFullScreenContent
|
172
177
|
on.rewardedInterstitialAdImpression
|
173
178
|
on.rewardedInterstitialAdShowedFullScreenContent
|
179
|
+
on.rewardedInterstitial.rewarded
|
174
180
|
*/
|
175
181
|
|
176
182
|
document.addEventListener('on.RewardedInterstitialAdLoaded', () => {
|
@@ -190,6 +196,7 @@ on.rewardedAdDismissedFullScreenContent
|
|
190
196
|
on.rewardedAdFailedToShowFullScreenContent
|
191
197
|
on.rewardedAdImpression
|
192
198
|
on.rewardedAdShowedFullScreenContent
|
199
|
+
on.rewarded.rewarded
|
193
200
|
*/
|
194
201
|
|
195
202
|
document.addEventListener('on.RewardedAdLoaded', () => {
|
package/package.json
CHANGED
package/plugin.xml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
2
2
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
3
|
-
id="emi-indo-cordova-plugin-admob" version="0.0.
|
3
|
+
id="emi-indo-cordova-plugin-admob" version="0.0.7">
|
4
4
|
|
5
5
|
<name>emiAdmobPlugin</name>
|
6
6
|
<description>Cordova Plugin Admob Android</description>
|
@@ -9,21 +9,30 @@ public class emiAdmobPlugin : CDVPlugin, GADFullScreenContentDelegate, GADBanner
|
|
9
9
|
private var interstitial: GADInterstitialAd?
|
10
10
|
private var rewardedAd: GADRewardedAd?
|
11
11
|
private var rewardedInterstitialAd: GADRewardedInterstitialAd?
|
12
|
+
|
13
|
+
var isBannerShowing = false
|
12
14
|
|
13
15
|
|
14
16
|
@objc
|
15
17
|
func initialize(_ command: CDVInvokedUrlCommand) {
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
let ads = GADMobileAds.sharedInstance()
|
20
|
+
ads.start { status in
|
21
|
+
// Optional: Log each adapter's initialization latency.
|
22
|
+
let adapterStatuses = status.adapterStatusesByClassName
|
23
|
+
for adapter in adapterStatuses {
|
24
|
+
let adapterStatus = adapter.value
|
25
|
+
NSLog("Adapter Name: %@, Description: %@, Latency: %f", adapter.key,
|
26
|
+
adapterStatus.description, adapterStatus.latency)
|
27
|
+
}
|
28
|
+
let pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "on.SdkInitializationComplete")
|
29
|
+
self.commandDelegate.send(pluginResult, callbackId: command.callbackId)
|
30
|
+
}
|
22
31
|
}
|
23
32
|
|
24
33
|
|
25
34
|
@objc
|
26
|
-
func
|
35
|
+
func showBannerAd(_ command: CDVInvokedUrlCommand) {
|
27
36
|
let bannerAdUnitId = command.arguments[0] as? String ?? ""
|
28
37
|
let position = command.arguments[1] as? String ?? ""
|
29
38
|
bannerView = GADBannerView(adSize: GADAdSizeBanner)
|
@@ -145,6 +154,25 @@ public class emiAdmobPlugin : CDVPlugin, GADFullScreenContentDelegate, GADBanner
|
|
145
154
|
}
|
146
155
|
|
147
156
|
|
157
|
+
@objc
|
158
|
+
func removeBannerAd(_ command: CDVInvokedUrlCommand) {
|
159
|
+
|
160
|
+
if(bannerView != nil){
|
161
|
+
self.isBannerShowing = true;
|
162
|
+
}
|
163
|
+
|
164
|
+
if(self.isBannerShowing){
|
165
|
+
|
166
|
+
self.isBannerShowing = self.unLoadBanner(self.bannerView)
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
func unLoadBanner(_ bannerView: UIView?) -> Bool{
|
171
|
+
bannerView?.removeFromSuperview()
|
172
|
+
return false
|
173
|
+
}
|
174
|
+
|
175
|
+
|
148
176
|
@objc
|
149
177
|
func loadInterstitialAd(_ command: CDVInvokedUrlCommand) {
|
150
178
|
|
@@ -170,7 +198,7 @@ public class emiAdmobPlugin : CDVPlugin, GADFullScreenContentDelegate, GADBanner
|
|
170
198
|
} )
|
171
199
|
|
172
200
|
}
|
173
|
-
|
201
|
+
|
174
202
|
@objc
|
175
203
|
func showInterstitialAd(_ command: CDVInvokedUrlCommand) {
|
176
204
|
if interstitial != nil {
|