emi-indo-cordova-plugin-admob 0.0.4 → 0.0.6

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 CHANGED
@@ -27,18 +27,25 @@ https://user-images.githubusercontent.com/78555833/228323239-e9e18e74-b814-4ca8-
27
27
 
28
28
 
29
29
 
30
-
30
+ ## 💰Sponsor this project
31
+ [![PayPal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://paypal.me/emiindo)
32
+
31
33
  ## Features
32
34
 
33
35
  - Banner Ads
34
36
  - Interstitial Ads
35
37
  - Rewarded Ads
36
38
  - Rewarded interstitial Ads
39
+ - [Consent](https://github.com/EMI-INDO/emi-indo-cordova-plugin-consent)
40
+ - Mediation
37
41
 
38
42
  ## Coming soon
39
43
  - App Open Ads
40
- - User Consent
41
- - Mediation ( In the process )
44
+ - User Consent ( Finished ) [emi-indo-cordova-plugin-consent](https://github.com/EMI-INDO/emi-indo-cordova-plugin-consent)
45
+ - Mediation ( Finished )
46
+
47
+
48
+
42
49
 
43
50
 
44
51
  ## Installation
@@ -55,135 +62,244 @@ cordova plugin add https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob --v
55
62
  cordova plugin rm emi-indo-cordova-plugin-admob
56
63
  ```
57
64
 
58
- ## Upgrade Mobile Ads SDK
65
+ ## upgrade Mobile Ads SDK
59
66
  [Release Notes Mobile Ads SDK:](https://developers.google.com/admob/android/rel-notes)
60
67
  ```sh
61
- cordova plugin add https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob --variable APP_ID_ANDROID=ca-app-pub-3940256099942544~3347511713 --variable PLAY_SERVICES_VERSION="xxxx"
68
+ cordova plugin add emi-indo-cordova-plugin-admob --variable APP_ID_ANDROID=ca-app-pub-3940256099942544~3347511713 --variable PLAY_SERVICES_VERSION="xxxx"
62
69
  ```
63
70
 
71
+ ## Response Info
72
+ - Here is a sample output returned by responseInfo = true showing the debugging data returned for a loaded ad:
64
73
 
74
+ ```sh
75
+ {
76
+ "Response ID": "COOllLGxlPoCFdAx4Aod-Q4A0g",
77
+ "Mediation Adapter Class Name": "com.google.ads.mediation.admob.AdMobAdapter",
78
+ "Adapter Responses": [
79
+ {
80
+ "Adapter": "com.google.ads.mediation.admob.AdMobAdapter",
81
+ "Latency": 328,
82
+ "Ad Source Name": "Reservation campaign",
83
+ "Ad Source ID": "7068401028668408324",
84
+ "Ad Source Instance Name": "[DO NOT EDIT] Publisher Test Interstitial",
85
+ "Ad Source Instance ID": "4665218928925097",
86
+ "Credentials": {},
87
+ "Ad Error": "null"
88
+ }
89
+ ],
90
+ "Loaded Adapter Response": {
91
+ "Adapter": "com.google.ads.mediation.admob.AdMobAdapter",
92
+ "Latency": 328,
93
+ "Ad Source Name": "Reservation campaign",
94
+ "Ad Source ID": "7068401028668408324",
95
+ "Ad Source Instance Name": "[DO NOT EDIT] Publisher Test Interstitial",
96
+ "Ad Source Instance ID": "4665218928925097",
97
+ "Credentials": {},
98
+ "Ad Error": "null"
99
+ },
100
+ "Response Extras": {
101
+ "mediation_group_name": "Campaign"
102
+ }
103
+ }
104
+ ```
65
105
 
66
- ## 💰Sponsor this project
67
- [![PayPal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://paypal.me/emiindo)
68
106
 
69
107
  ## deviceready
70
108
 
71
109
  [Example ](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/blob/main/example/index.html) - index.html:
72
110
 
73
111
 
112
+ ```sh
74
113
 
114
+ // Before loading ads, have your app initialize the Google Mobile Ads SDK by calling
115
+ // This needs to be done only once, ideally at app launch.
75
116
 
76
- ```sh
117
+ cordova.plugins.emiAdmobPlugin.initialize();
77
118
 
78
- /*
79
- ( set banner size: )
119
+ document.addEventListener('on.SdkInitializationComplete', () => {
80
120
 
81
- Anchored_adaptive
82
- Inline_adaptive
83
- BANNER
84
- LARGE_BANNER
85
- MEDIUM_RECTANGLE
86
- FULL_BANNER
87
- LEADERBOARD
88
- Smart Banners = DEPRECATED
89
- default: Anchored_adaptive
121
+ alert("on Sdk Initialization Complete");
90
122
 
123
+ });
91
124
 
92
- ( set banner position )
93
125
 
94
- top-right
95
- top-center
96
- left
97
- center
98
- right
99
- bottom-center
100
- bottom-right
126
+ ```
101
127
 
102
- adaptiveWidth = 320 // default: 320
103
- */
128
+ ## Banner Ads
104
129
 
130
+ > __Note__
131
+ ### Variable name and index (final) cannot be changed.
132
+ - bannerAdUnitId | index 0
133
+ - position | index 1
134
+ - size | index 2
135
+ - adaptiveWidth | index 3
105
136
 
106
- var bannerAdUnitId = "ca-app-pub-3940256099942544/6300978111"
107
- var interstitialAdAdUnitId = "ca-app-pub-3940256099942544/1033173712"
108
- var rewardedInterstitialAdUnitId = "ca-app-pub-3940256099942544/5354046379"
109
- var rewardedAdAdUnitId = "ca-app-pub-3940256099942544/5224354917"
110
137
 
111
- var size = "Anchored_adaptive"
112
- var position = "bottom-center"
113
- var adaptiveWidth = 320
138
+ ```sh
139
+ /// setting banner size: BANNER | LARGE_BANNER | MEDIUM_RECTANGLE | FULL_BANNER | LEADERBOARD | default: "BANNER" | (Smart Banners = DEPRECATED) | Inline_adaptive | Anchored_adaptive
114
140
 
141
+ /// setting banner position: top-right | top-center | left | center | right | bottom-center | bottom-right | default: "bottom-left"
115
142
 
116
- // Before loading ads, have your app initialize the Google Mobile Ads SDK by calling
117
- // This needs to be done only once, ideally at app launch.
118
143
 
119
- cordova.plugins.emiAdmobPlugin.initialize();
144
+ // Banner Adaptive
120
145
 
121
- document.addEventListener('on.SdkInitializationComplete', () => {
146
+ let showBannerAdaptive = () => {
147
+ cordova.plugins.emiAdmobPlugin.showBannerAd(
148
+ bannerAdUnitId = "ca-app-pub-3940256099942544/6300978111",
149
+ position = "bottom-center",
150
+ size = "Inline_adaptive", // | Inline_adaptive | Anchored_adaptive
151
+ adaptiveWidth = 320,
122
152
 
123
- alert("on Sdk Initialization Complete");
153
+ (seccess) => { console.log("success") },
154
+ (error) => { alert(error)
124
155
 
125
- });
156
+ });
157
+ }
126
158
 
159
+ // call showBannerAdaptive();
127
160
 
128
- ```
161
+ // not Adaptive banner
162
+
163
+ let showBannerNotAdaptive = () => {
164
+ cordova.plugins.emiAdmobPlugin.showBannerAd(
165
+ bannerAdUnitId = "ca-app-pub-3940256099942544/6300978111",
166
+ position = "bottom-center",
167
+ size = "BANNER",
168
+
169
+ (seccess) => { console.log("success") },
170
+ (error) => { alert(error)
171
+
172
+ });
173
+ }
174
+
175
+ // call showBannerNotAdaptive();
176
+
177
+ // Remove Banner
178
+
179
+ let removeBannerAd = () => {
180
+ cordova.plugins.emiAdmobPlugin.removeBannerAd();
181
+ }
182
+
183
+ // call removeBannerAd();
129
184
 
130
- ## Banner Ads
131
- ```sh
132
- // Load a Show BANNER cordova.plugins.emiAdmobPlugin.showBannerAd(bannerAdUnitId, size, position);
133
- // Load a Show BANNER adaptive cordova.plugins.emiAdmobPlugin.showBannerAd(bannerAdUnitId, size, position, adaptiveWidth);
134
- // remove cordova.plugins.emiAdmobPlugin.removeBannerAd();
135
185
  ```
136
186
  [Banner ads event](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob#-banner-ads-) - callback:
137
187
 
138
188
 
139
- ## Interstitial ads
189
+ ## Interstitial Ads
190
+
191
+ > __Note__
192
+ ### Variable name and index (final) cannot be changed.
193
+ - interstitialAdAdUnitId | index 0
194
+ - responseInfo | index 1
140
195
 
141
196
  ```sh
197
+ // Load Interstitial Ad
198
+
199
+ let loadInterstitialAd = () => {
200
+ cordova.plugins.emiAdmobPlugin.loadInterstitialAd(
201
+ interstitialAdAdUnitId = "ca-app-pub-3940256099942544/1033173712",
202
+ responseInfo = true, // boolean (debugging)
203
+
204
+ (info) => { alert(info) },
205
+ (error) => { alert(error)
206
+
207
+ });
208
+ }
209
+
210
+ // call loadInterstitialAd();
142
211
 
143
- // Load cordova.plugins.emiAdmobPlugin.loadInterstitialAd(interstitialAdAdUnitId);
212
+ // Show Interstitial Ad
213
+
214
+ let showInterstitialAd = () => {
215
+ cordova.plugins.emiAdmobPlugin.showInterstitialAd();
216
+ }
217
+
218
+ // call showInterstitialAd();
144
219
 
145
- // Show cordova.plugins.emiAdmobPlugin.showInterstitialAd();
146
220
  ```
147
221
 
148
222
  [Interstitial ads event](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob#-interstitial-ads-) - callback:
149
223
 
150
224
 
151
225
 
152
- ## Rewarded ads
226
+ ## Rewarded Ads
227
+
228
+ > __Note__
229
+ ### Variable name and index (final) cannot be changed.
230
+ - rewardedAdAdUnitId | index 0
231
+ - responseInfo | index 1
153
232
 
154
233
  ```sh
155
234
 
156
- // Load cordova.plugins.emiAdmobPlugin.loadRewardedAd(rewardedAdAdUnitId);
235
+ // Load Rewarded Ad
236
+
237
+ let loadRewardedAd = () => {
238
+ cordova.plugins.emiAdmobPlugin.loadRewardedAd(
239
+ rewardedAdAdUnitId = "ca-app-pub-3940256099942544/5224354917",
240
+ responseInfo = true, // boolean (debugging)
241
+
242
+
243
+ (info) => { alert(info) },
244
+ (error) => { alert(error)
245
+
246
+ });
247
+ }
248
+
249
+ // call loadRewardedAd();
250
+
251
+ // Show Rewarded Ad
252
+
253
+ let showRewardedAd = () => {
254
+ cordova.plugins.emiAdmobPlugin.showRewardedAd();
255
+ }
256
+
257
+ // call showRewardedAd();
157
258
 
158
- // Show cordova.plugins.emiAdmobPlugin.showRewardedAd();
159
259
 
160
260
  ```
161
261
 
162
262
  [Rewarded ads event](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob#-rewarded-ads-) - callback:
163
263
 
164
264
 
165
- ## Rewarded interstitial ads
265
+ ## Rewarded interstitial Ads
266
+
267
+ > __Note__
268
+ ### Variable name and index (final) cannot be changed.
269
+ - rewardedInterstitialAdUnitId | index 0
270
+ - responseInfo | index 1
166
271
 
167
272
  ```sh
168
273
 
169
- // Load cordova.plugins.emiAdmobPlugin.loadRewardedInterstitialAd(rewardedInterstitialAdUnitId);
274
+ // load Rewarded Interstitial Ad
170
275
 
171
- // Show cordova.plugins.emiAdmobPlugin.showRewardedInterstitialAd();
276
+ let loadRewardedInterstitialAd = () => {
277
+ cordova.plugins.emiAdmobPlugin.loadRewardedInterstitialAd(
278
+ rewardedInterstitialAdUnitId = "ca-app-pub-3940256099942544/5354046379",
279
+ responseInfo = true, // boolean (debugging)
280
+
281
+ (info) => { alert(info) },
282
+ (error) => { alert(error)
172
283
 
173
- ```
284
+ });
285
+ }
174
286
 
175
- [Rewarded interstitial ads event](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob#-rewarded-ads-) - callback:
287
+ // call loadRewardedInterstitialAd();
176
288
 
289
+ // Show Rewarded Interstitial Ad
177
290
 
178
- ## handle success or error
291
+ const showRewardedInterstitialAd = () => {
292
+ cordova.plugins.emiAdmobPlugin.showRewardedInterstitialAd();
293
+ }
179
294
 
180
- [Example code ](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/blob/main/example/getMediationAdapterName.html)
181
- ```sh
295
+ // cal showRewardedInterstitialAd();
182
296
 
183
- cordova.plugins.emiAdmobPlugin.loadRewardedAd(rewardedAdAdUnitId, success, error);
184
297
 
185
298
  ```
186
299
 
300
+ [Rewarded interstitial ads event](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob#-rewarded-ads-) - callback:
301
+
302
+
187
303
 
188
304
  # Event | callback:
189
305
  ### event code
@@ -197,12 +313,27 @@ alert("on.banner Ad Loaded");
197
313
 
198
314
  ```
199
315
 
316
+ > __Note__
317
+ ### (final) cannot be changed.
318
+
200
319
  ## ( SDK )
201
320
  - on.SdkInitializationComplete
202
321
 
203
322
 
204
323
  ## ( Banner Ads )
205
324
 
325
+ ### position
326
+
327
+ - top-right
328
+ - top-center
329
+ - left
330
+ - center
331
+ - right
332
+ - bottom-center
333
+ - bottom-right
334
+
335
+
336
+
206
337
  ### size
207
338
  - Anchored_adaptive
208
339
  - Inline_adaptive
@@ -211,21 +342,11 @@ alert("on.banner Ad Loaded");
211
342
  - MEDIUM_RECTANGLE
212
343
  - FULL_BANNER
213
344
  - LEADERBOARD
345
+ - adaptiveWidth = number
214
346
  - Smart Banners = DEPRECATED
215
347
  - default: Anchored_adaptive
216
348
 
217
349
 
218
- ### position
219
-
220
- - top-right
221
- - top-center
222
- - left
223
- - center
224
- - right
225
- - bottom-center
226
- - bottom-right
227
- - adaptiveWidth = number
228
- > default: 320
229
350
 
230
351
 
231
352
  ### Event Load a Show
@@ -299,7 +420,7 @@ alert("on.banner Ad Loaded");
299
420
 
300
421
  ## get Mediation Adapter Name
301
422
 
302
- [Example code ](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/blob/main/example/getMediationAdapterName.html) - get Mediation Adapter Name:
423
+ responseInfo = true // (debugging)
303
424
 
304
425
  <img src="https://user-images.githubusercontent.com/78555833/230655800-0dbc3f12-72fb-4cf3-b4e6-801704fade28.png" width="250">
305
426
 
@@ -336,6 +457,39 @@ cordova plugin add emi-indo-cordova-plugin-mediation-unity
336
457
  cordova plugin add emi-indo-cordova-plugin-mediation-applovin
337
458
  ```
338
459
 
460
+ - ================================
461
+
462
+
463
+ ## AdColony Ads
464
+ [Integrate AdColony with Mediation :](https://developers.google.com/admob/android/mediation/adcolony)
465
+ - (Adapter default: 4.8.0.1)
466
+ ### Installation
467
+ ```sh
468
+ cordova plugin add emi-indo-cordova-plugin-mediation-adcolony
469
+ ```
470
+
471
+ - ================================
472
+
473
+
474
+ ## Chartboost Ads
475
+ [Integrate Chartboost with Mediation :](https://developers.google.com/admob/android/mediation/chartboost)
476
+ - (Adapter default: 9.2.1.0)
477
+ ### Installation
478
+ ```sh
479
+ cordova plugin add emi-indo-cordova-plugin-mediation-chartboost
480
+ ```
481
+
482
+ - ================================
483
+
484
+
485
+ ## ironSource Ads
486
+ [Integrate ironSource with Mediation :](https://developers.google.com/admob/android/mediation/ironsource)
487
+ - (Adapter default: 7.2.7.0)
488
+ ### Installation
489
+ ```sh
490
+ cordova plugin add emi-indo-cordova-plugin-mediation-ironsource
491
+ ```
492
+
339
493
 
340
494
 
341
495
  ## Variables name or preference name
@@ -356,25 +510,33 @@ cordova plugin add emi-indo-cordova-plugin-mediation-meta --variable META_ADAPTE
356
510
  - --variable META_ADAPTER_VERSION="xxxxx"
357
511
  - --variable UNITY_ADAPTER_VERSION="xxxxx"
358
512
  - --variable APPLOVIN_ADAPTER_VERSION="xxxxx"
513
+ - --variable ADCOLONY_ADAPTER_VERSION="xxxxx"
514
+ - --variable CHARTBOOST_ADAPTER_VERSION="xxxxx"
515
+ - --variable IRONSOURCE_ADAPTER_VERSION="xxxxx"
359
516
 
360
517
  ### preference name
361
518
 
362
519
  - META_ADAPTER_VERSION
363
520
  - UNITY_ADAPTER_VERSION
364
521
  - APPLOVIN_ADAPTER_VERSION
365
-
366
-
522
+ - ADCOLONY_ADAPTER_VERSION
523
+ - CHARTBOOST_ADAPTER_VERSION
524
+ - IRONSOURCE_ADAPTER_VERSION
367
525
 
368
526
  - ================================
369
527
 
370
528
 
529
+ emi-indo-cordova-plugin-admob@0.0.5
371
530
 
372
-
373
- > __Note__
531
+
374
532
  > - ## Note Release
375
- > emi-indo-cordova-plugin-admob@0.0.4
376
-
533
+ - [emi-indo-cordova-plugin-admob@0.0.4](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/releases/tag/%400.0.4)
534
+
535
+ - [emi-indo-cordova-plugin-admob@0.0.5](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/releases/tag/v0.0.5)
536
+
537
+ <img src="https://user-images.githubusercontent.com/78555833/231241800-8834ca2a-fa95-4cc2-91ca-1478c6b3c1ef.jpg" width="250">
377
538
 
539
+ - [emi-indo-cordova-plugin-admob@0.0.6](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/releases/tag/v0.0.6)
378
540
 
379
541
 
380
542
  ### Platform Support
@@ -0,0 +1,115 @@
1
+ <html>
2
+ <head>
3
+ <script type="text/javascript" src="cordova.js"></script>
4
+ </head>
5
+ <body>
6
+
7
+ <script>
8
+
9
+ // Installation
10
+
11
+ // cordova plugin add emi-indo-cordova-plugin-consent
12
+ // cordova plugin add emi-indo-cordova-plugin-admob
13
+
14
+
15
+ let _getConsentRequest = () => {
16
+ cordova.plugins.emiAdmobPlugin.getConsentRequest(
17
+ setTagForUnderAgeOfConsent = false, // boolean
18
+
19
+ (status) => { alert(status) }, // check event code
20
+ (error) => { alert(error)
21
+
22
+ });
23
+ }
24
+
25
+ // call _getConsentRequest();
26
+
27
+
28
+
29
+ let _consentReset = () => {
30
+ cordova.plugins.emiAdmobPlugin.consentReset();
31
+ }
32
+
33
+ // call _consentReset();
34
+
35
+
36
+
37
+
38
+ document.addEventListener("deviceready", function(){
39
+
40
+
41
+
42
+
43
+ document.addEventListener('onConsentInfoUpdateSuccess', () => {
44
+
45
+ alert("on Consent Info Update Success");
46
+
47
+ });
48
+
49
+ document.addEventListener('onConsentInfoUpdateFailure', () => {
50
+
51
+ alert("on Consen Info Update Failure");
52
+
53
+ });
54
+
55
+ ////////////////////////////////////////////////
56
+
57
+ // https://developers.google.com/admob/android/privacy/api/reference/com/google/android/ump/ConsentInformation.ConsentStatus
58
+
59
+ document.addEventListener('on.ConsentStatus.NOT_REQUIRED', () => {
60
+ // Constant Value: 1
61
+ alert("User consent not required.");
62
+
63
+ });
64
+
65
+ document.addEventListener('on.ConsentStatus.OBTAINED', () => {
66
+ // Constant Value: 3
67
+ alert("User consent obtained. Personalized vs non-personalized undefined.");
68
+
69
+ });
70
+
71
+ document.addEventListener('on.ConsentStatus.REQUIRED', () => {
72
+ // Constant Value: 2
73
+ // is Consent Form Available = the code auto, load Consent Form and consent Form show.
74
+ alert("User consent required but not yet obtained.");
75
+
76
+ });
77
+
78
+ document.addEventListener('on.ConsentStatus.UNKNOWN', () => {
79
+ //Constant Value: 0
80
+ alert("Consent status is unknown.");
81
+
82
+ });
83
+
84
+
85
+ ////////////////////////////////////////////////////////////
86
+
87
+ document.addEventListener('on.loadConsentFormError', () => {
88
+
89
+ alert("on load Consent Form Error");
90
+
91
+ });
92
+
93
+ document.addEventListener('on.ConsentFormNotAvailable', () => {
94
+
95
+ alert("on Consent Form Not Available");
96
+
97
+ });
98
+
99
+
100
+
101
+
102
+ }, false);
103
+ </script>
104
+
105
+
106
+
107
+ <p> <button onclick="_getConsentRequest();">get Consent Request</button></p>
108
+
109
+ <p> <button onclick="_consentReset();">Consent reset</button></p>
110
+
111
+
112
+
113
+
114
+ </body>
115
+ </html>