emi-indo-cordova-plugin-admob 1.5.3 → 1.5.5
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/.vscode/settings.json +1 -5
- package/README.md +42 -148
- package/example/www/css/index.css +110 -0
- package/example/www/index.html +27 -0
- package/example/www/js/appOpenAd.js +146 -0
- package/example/www/js/bannerAd.js +156 -0
- package/example/www/js/deviceready.js +110 -0
- package/example/www/js/interstitialAd.js +123 -0
- package/example/www/js/rewardedAd.js +125 -0
- package/package.json +2 -2
- package/plugin.xml +4 -5
- package/src/android/emiAdmobPlugin.kt +839 -695
- package/src/ios/emiAdmobPlugin.m +898 -974
- package/www/emiAdmobPlugin.js +4 -4
package/.vscode/settings.json
CHANGED
package/README.md
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
# emi-indo-cordova-plugin-admob
|
4
4
|
Cordova Plugin Admob Android and IOS
|
5
5
|
|
6
|
-
### Mobile Ads SDK (Android: 23.
|
7
|
-
### User Messaging Platform (UMP Android: 3.
|
6
|
+
### Mobile Ads SDK (Android: 23.5.0) [Release Notes:](https://developers.google.com/admob/android/rel-notes)
|
7
|
+
### User Messaging Platform (UMP Android: 3.1.0) [Release Notes:](https://developers.google.com/admob/android/privacy/release-notes)
|
8
8
|
|
9
9
|
### Mobile Ads SDK (IOS: 11.10.0) [Release Notes:](https://developers.google.com/admob/ios/rel-notes)
|
10
10
|
|
@@ -12,6 +12,7 @@
|
|
12
12
|
### IAB Europe Transparency & Consent Framework (CPM: 2.2.0)
|
13
13
|
|
14
14
|
|
15
|
+
## New example https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/tree/main/example/www
|
15
16
|
|
16
17
|
|
17
18
|
## Minimum Cordova Engines
|
@@ -21,7 +22,7 @@
|
|
21
22
|
|
22
23
|
## IOS Ad Support IOS 18 *
|
23
24
|
> [!WARNING]
|
24
|
-
> - emi-indo-cordova-plugin-admob@1.5.2
|
25
|
+
> - emi-indo-cordova-plugin-admob@1.5.2 or higher
|
25
26
|
> - Minimum supported Xcode version up to 15.3 or higher
|
26
27
|
> - minimum deployment-target: 12.2
|
27
28
|
## Minimum macOS | Xcode, and others
|
@@ -91,17 +92,7 @@ https://developers.google.com/admob/ios/quick-start
|
|
91
92
|
|
92
93
|
## [Check all release notes:](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/releases/)
|
93
94
|
|
94
|
-
> [!WARNING]
|
95
|
-
> WARNING options configuration was previously an array [], now v.1.4.9 or later must be an object{}
|
96
|
-
> example
|
97
|
-
```
|
98
|
-
previous example
|
99
|
-
[ adUnitId = App_Open_ID, autoShow = true ] // Deprecated
|
100
|
-
now
|
101
|
-
{ adUnitId: App_Open_ID, autoShow: true }
|
102
95
|
|
103
|
-
cordova.plugins.emiAdmobPlugin.loadAppOpenAd({ adUnitId: App_Open_ID, autoShow: true });
|
104
|
-
```
|
105
96
|
|
106
97
|
## Features
|
107
98
|
<details>
|
@@ -124,8 +115,19 @@ now
|
|
124
115
|
|
125
116
|
## Installation
|
126
117
|
|
118
|
+
- Only platform Android
|
119
|
+
```sh
|
120
|
+
cordova plugin add emi-indo-cordova-plugin-admob --save --variable APP_ID_ANDROID=ca-app-pub-xxx~xxx
|
121
|
+
```
|
122
|
+
|
123
|
+
- Only platform IOS
|
127
124
|
```sh
|
128
|
-
cordova plugin add emi-indo-cordova-plugin-admob
|
125
|
+
cordova plugin add emi-indo-cordova-plugin-admob --save --variable APP_ID_IOS=ca-app-pub-xxx~xxx
|
126
|
+
```
|
127
|
+
|
128
|
+
- Platform Both
|
129
|
+
```sh
|
130
|
+
cordova plugin add emi-indo-cordova-plugin-admob --save --variable APP_ID_ANDROID=ca-app-pub-xxx~xxx --variable APP_ID_IOS=ca-app-pub-xxx~xxx
|
129
131
|
```
|
130
132
|
|
131
133
|
## Remove
|
@@ -177,7 +179,7 @@ console.log("On Sdk Initialization version: " + sdkVersion);
|
|
177
179
|
// Support Platform: Android | IOS
|
178
180
|
cordova.plugins.emiAdmobPlugin.globalSettings({config_globalSettings}); // Optional
|
179
181
|
cordova.plugins.emiAdmobPlugin.targeting({config_Targeting}); // Optional
|
180
|
-
// UMP SDK
|
182
|
+
// UMP SDK 3.1.0
|
181
183
|
cordova.plugins.emiAdmobPlugin.getConsentRequest(); // (Platform: Both) // Deprecated
|
182
184
|
cordova.plugins.emiAdmobPlugin.consentReset(); // (Platform: Both) // Optional
|
183
185
|
cordova.plugins.emiAdmobPlugin.showPrivacyOptionsForm(); // (Platform: Both) // Optional
|
@@ -207,13 +209,14 @@ document.addEventListener('on.sdkInitialization', (data) => {
|
|
207
209
|
// JSON.stringify(data)
|
208
210
|
const sdkVersion = data.version;
|
209
211
|
// const adAdapter = data.adapters;
|
210
|
-
|
212
|
+
const conStatus = data.consentStatus;
|
211
213
|
// const gdprApplie = data.gdprApplies;
|
212
214
|
// const purposeConsent = data.purposeConsents;
|
213
215
|
// const vendorConsents = data.vendorConsents;
|
214
216
|
// const conTCString = data.consentTCString;
|
215
217
|
// const additionalConsent = data.additionalConsent;
|
216
218
|
console.log("On Sdk Initialization version: " + data.consentStatus);
|
219
|
+
console.log("On Consent Status: " + conStatus);
|
217
220
|
|
218
221
|
});
|
219
222
|
|
@@ -295,6 +298,14 @@ var Interstitial_ID;
|
|
295
298
|
var Rewarded_ID;
|
296
299
|
var Rewarded_Interstitial_ID;
|
297
300
|
|
301
|
+
/* https://support.google.com/admob/answer/9493252?hl=en
|
302
|
+
Best practice when using ad original ID unit,
|
303
|
+
the app must be uploaded to the play store or app store,
|
304
|
+
and you must upload it from there,
|
305
|
+
otherwise you may be subject to ad serving restrictions,
|
306
|
+
if it happens often, it is possible that your admob account will be permanently disabled.
|
307
|
+
*/
|
308
|
+
|
298
309
|
if (window.cordova.platformId === 'ios') {
|
299
310
|
|
300
311
|
App_Open_ID = 'ca-app-pub-3940256099942544/5575463023';
|
@@ -380,22 +391,6 @@ autoShow: false
|
|
380
391
|
cordova.plugins.emiAdmobPlugin.loadAppOpenAd({config});
|
381
392
|
cordova.plugins.emiAdmobPlugin.showAppOpenAd(); // default
|
382
393
|
|
383
|
-
// Advanced load (Optional)
|
384
|
-
cordova.plugins.emiAdmobPlugin.loadAppOpenAd(config,
|
385
|
-
|
386
|
-
(data) => {
|
387
|
-
|
388
|
-
console.log("Micros: " + data.micros);
|
389
|
-
console.log("Currency: " + data.currency);
|
390
|
-
console.log("Precision: " + data.precision);
|
391
|
-
console.log("AdUnitId: " + data.adUnitId};
|
392
|
-
|
393
|
-
},
|
394
|
-
(error) => {
|
395
|
-
|
396
|
-
console.error("Error: " + error);
|
397
|
-
|
398
|
-
});
|
399
394
|
|
400
395
|
|
401
396
|
<br>
|
@@ -403,14 +398,6 @@ autoShow: false
|
|
403
398
|
<li>example:</li></ul>
|
404
399
|
<pre>
|
405
400
|
|
406
|
-
WARNING options configuration was previously an array [], now v.1.4.9 or later must be an object{}
|
407
|
-
example
|
408
|
-
```
|
409
|
-
previous example
|
410
|
-
[ adUnitId = App_Open_ID, autoShow = true ] // Deprecated
|
411
|
-
now
|
412
|
-
{ adUnitId: App_Open_ID, autoShow: true }
|
413
|
-
|
414
401
|
cordova.plugins.emiAdmobPlugin.loadAppOpenAd({ adUnitId: App_Open_ID, autoShow: true });
|
415
402
|
```
|
416
403
|
</pre>
|
@@ -425,6 +412,9 @@ now
|
|
425
412
|
on.appOpenAd.failed.show
|
426
413
|
on.appOpenAd.show
|
427
414
|
on.appOpenAd.revenue
|
415
|
+
|
416
|
+
(DEBUG)
|
417
|
+
on.appOpenAd.responseInfo
|
428
418
|
<br>
|
429
419
|
</pre>
|
430
420
|
<li>example:</li></ul>
|
@@ -438,7 +428,7 @@ document.addEventListener('on.appOpenAd.loaded', () => {
|
|
438
428
|
</pre>
|
439
429
|
</details>
|
440
430
|
|
441
|
-
- [FULL AppOpenAd basic:
|
431
|
+
- [FULL AppOpenAd basic:](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/blob/main/Example/www/js/appOpenAd.js)
|
442
432
|
|
443
433
|
|
444
434
|
|
@@ -448,7 +438,7 @@ document.addEventListener('on.appOpenAd.loaded', () => {
|
|
448
438
|
<details>
|
449
439
|
<summary>Methods:</summary>
|
450
440
|
<pre>
|
451
|
-
cordova.plugins.emiAdmobPlugin.styleBannerAd({ padding: 50, margins: 50 }); // (Optional)
|
441
|
+
cordova.plugins.emiAdmobPlugin.styleBannerAd({ padding: 50, margins: 50 }); // (Optional only android)
|
452
442
|
cordova.plugins.emiAdmobPlugin.loadBannerAd({config});
|
453
443
|
cordova.plugins.emiAdmobPlugin.showBannerAd(); // default
|
454
444
|
cordova.plugins.emiAdmobPlugin.hideBannerAd(); // default
|
@@ -456,22 +446,7 @@ cordova.plugins.emiAdmobPlugin.removeBannerAd(); // default
|
|
456
446
|
</pre>
|
457
447
|
<li>example:</li></ul>
|
458
448
|
<pre>
|
459
|
-
|
460
|
-
|
461
|
-
// Deprecated
|
462
|
-
/*
|
463
|
-
const bannerConfig = [
|
464
|
-
|
465
|
-
adUnitId = Banner_ID,
|
466
|
-
position = "bottom-center",
|
467
|
-
size = "BANNER",
|
468
|
-
collapsible = "bottom", // (BETA) enable in globalSettings
|
469
|
-
adaptive_Width = 320, // Ignored
|
470
|
-
autoShow = true // boolean
|
471
|
-
]
|
472
|
-
*/
|
473
|
-
|
474
|
-
// NEW
|
449
|
+
|
475
450
|
```
|
476
451
|
const bannerConfig = {
|
477
452
|
|
@@ -484,23 +459,7 @@ const bannerConfig = {
|
|
484
459
|
|
485
460
|
}
|
486
461
|
|
487
|
-
cordova.plugins.emiAdmobPlugin.loadBannerAd(bannerConfig
|
488
|
-
// Advanced load (Optional)
|
489
|
-
(data) => {
|
490
|
-
// this data will be displayed after showBannerAd() applies to all ad types
|
491
|
-
console.log("Micros: " + data.micros);
|
492
|
-
console.log("Currency: " + data.currency);
|
493
|
-
console.log("Precision: " + data.precision);
|
494
|
-
console.log("AdUnitId: " + data.adUnitId};
|
495
|
-
|
496
|
-
},
|
497
|
-
(error) => {
|
498
|
-
|
499
|
-
console.error("Error: " + error);
|
500
|
-
|
501
|
-
}
|
502
|
-
|
503
|
-
);
|
462
|
+
cordova.plugins.emiAdmobPlugin.loadBannerAd(bannerConfig);
|
504
463
|
```
|
505
464
|
|
506
465
|
|
@@ -535,16 +494,7 @@ full_banner
|
|
535
494
|
leaderboard
|
536
495
|
fluid
|
537
496
|
|
538
|
-
|
539
|
-
IN_LINE // Deprecated
|
540
|
-
FULL_WIDTH // Deprecated
|
541
|
-
BANNER // Deprecated
|
542
|
-
FLUID // Deprecated
|
543
|
-
LARGE_BANNER // Deprecated
|
544
|
-
MEDIUM_RECTANGLE // Deprecated
|
545
|
-
FULL_BANNER // Deprecated
|
546
|
-
LEADERBOARD // Deprecated
|
547
|
-
adaptive_Width = number // Deprecated
|
497
|
+
|
548
498
|
</pre>
|
549
499
|
</details>
|
550
500
|
|
@@ -563,6 +513,7 @@ on.banner.remove
|
|
563
513
|
on.banner.hide
|
564
514
|
// new
|
565
515
|
on.is.collapsible
|
516
|
+
on.bannerAd.responseInfo
|
566
517
|
</pre>
|
567
518
|
<li>example:</li></ul>
|
568
519
|
<pre>
|
@@ -580,7 +531,7 @@ console.log("Collapsible Status: " + event.collapsible);
|
|
580
531
|
</pre>
|
581
532
|
</details>
|
582
533
|
|
583
|
-
[FULL Banner basic:
|
534
|
+
[FULL Banner basic:](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/blob/main/Example/www/js/bannerAd.js)
|
584
535
|
|
585
536
|
|
586
537
|
## Interstitial ADS
|
@@ -593,36 +544,12 @@ console.log("Collapsible Status: " + event.collapsible);
|
|
593
544
|
cordova.plugins.emiAdmobPlugin.loadInterstitialAd({config});
|
594
545
|
cordova.plugins.emiAdmobPlugin.showInterstitialAd(); // default
|
595
546
|
|
596
|
-
// Advanced load (Optional)
|
597
|
-
cordova.plugins.emiAdmobPlugin.loadInterstitialAd(config,
|
598
|
-
|
599
|
-
(data) => {
|
600
|
-
|
601
|
-
console.log("Micros: " + data.micros);
|
602
|
-
console.log("Currency: " + data.currency);
|
603
|
-
console.log("Precision: " + data.precision);
|
604
|
-
console.log("AdUnitId: " + data.adUnitId};
|
605
|
-
|
606
|
-
},
|
607
|
-
(error) => {
|
608
|
-
|
609
|
-
console.error("Error: " + error);
|
610
|
-
|
611
|
-
});
|
612
547
|
<br>
|
613
548
|
</pre>
|
614
549
|
<li>example:</li></ul>
|
615
550
|
<pre>
|
616
551
|
|
617
|
-
WARNING options configuration was previously an array [], now v.1.4.9 or later must be an object{}
|
618
|
-
example
|
619
|
-
```
|
620
|
-
/*
|
621
|
-
previous example
|
622
|
-
[ adUnitId = Interstitial_ID, autoShow = true ] // Deprecated
|
623
552
|
|
624
|
-
{ adUnitId: Interstitial_ID, autoShow: true } // NEW
|
625
|
-
*/
|
626
553
|
cordova.plugins.emiAdmobPlugin.loadInterstitialAd({ adUnitId: "ca-app-pub-3940256099942544/1033173712", autoShow: true });
|
627
554
|
```
|
628
555
|
|
@@ -641,6 +568,7 @@ on.interstitial.impression
|
|
641
568
|
on.interstitial.show
|
642
569
|
// new
|
643
570
|
on.interstitial.revenue
|
571
|
+
on.interstitialAd.responseInfo
|
644
572
|
<br>
|
645
573
|
</pre>
|
646
574
|
<li>example:</li></ul>
|
@@ -666,7 +594,7 @@ document.addEventListener('on.interstitial.dismissed', () => {
|
|
666
594
|
</details>
|
667
595
|
|
668
596
|
|
669
|
-
[FULL Interstitial basic:
|
597
|
+
[FULL Interstitial basic: ](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/blob/main/Example/www/js/interstitialAd.js)
|
670
598
|
|
671
599
|
|
672
600
|
|
@@ -687,25 +615,6 @@ cordova.plugins.emiAdmobPlugin.showRewardedInterstitialAd(); // default
|
|
687
615
|
<pre>
|
688
616
|
|
689
617
|
cordova.plugins.emiAdmobPlugin.loadRewardedInterstitialAd({ adUnitId: Rewarded_Interstitial_ID, autoShow: true });
|
690
|
-
|
691
|
-
// Advanced load (Optional)
|
692
|
-
cordova.plugins.emiAdmobPlugin.loadRewardedInterstitialAd(config,
|
693
|
-
|
694
|
-
(data) => {
|
695
|
-
|
696
|
-
console.log("Micros: " + data.micros);
|
697
|
-
console.log("Currency: " + data.currency);
|
698
|
-
console.log("Precision: " + data.precision);
|
699
|
-
console.log("AdUnitId: " + data.adUnitId};
|
700
|
-
|
701
|
-
},
|
702
|
-
(error) => {
|
703
|
-
|
704
|
-
console.error("Error: " + error);
|
705
|
-
|
706
|
-
});
|
707
|
-
|
708
|
-
|
709
618
|
|
710
619
|
</pre>
|
711
620
|
</details>
|
@@ -724,6 +633,7 @@ on.rewardedInt.userEarnedReward
|
|
724
633
|
// new
|
725
634
|
on.rewardedInt.revenue
|
726
635
|
on.rewardedInt.ad.skip
|
636
|
+
on.rewardedIntAd.responseInfo
|
727
637
|
<br>
|
728
638
|
</pre>
|
729
639
|
<li>example:</li></ul>
|
@@ -769,23 +679,6 @@ cordova.plugins.emiAdmobPlugin.showRewardedAd(); // default
|
|
769
679
|
|
770
680
|
cordova.plugins.emiAdmobPlugin.loadRewardedAd({ adUnitId: Rewarded_ID, autoShow: true });
|
771
681
|
|
772
|
-
// Advanced load (Optional)
|
773
|
-
cordova.plugins.emiAdmobPlugin.loadRewardedAd(config,
|
774
|
-
|
775
|
-
(data) => {
|
776
|
-
|
777
|
-
console.log("Micros: " + data.micros);
|
778
|
-
console.log("Currency: " + data.currency);
|
779
|
-
console.log("Precision: " + data.precision);
|
780
|
-
console.log("AdUnitId: " + data.adUnitId};
|
781
|
-
|
782
|
-
},
|
783
|
-
(error) => {
|
784
|
-
|
785
|
-
console.error("Error: " + error);
|
786
|
-
|
787
|
-
});
|
788
|
-
|
789
682
|
|
790
683
|
</pre>
|
791
684
|
</details>
|
@@ -804,6 +697,7 @@ on.reward.userEarnedReward
|
|
804
697
|
// new
|
805
698
|
on.rewarded.revenue
|
806
699
|
on.rewarded.ad.skip
|
700
|
+
on.rewardedAd.responseInfo
|
807
701
|
|
808
702
|
<br>
|
809
703
|
</pre>
|
@@ -829,7 +723,7 @@ document.addEventListener('on.rewarded.dismissed', () => {
|
|
829
723
|
</pre>
|
830
724
|
</details>
|
831
725
|
|
832
|
-
[FULL Rewarded basic:
|
726
|
+
[FULL Rewarded basic: ](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/blob/main/Example/www/js/rewardedAd.js)
|
833
727
|
|
834
728
|
|
835
729
|
|
@@ -0,0 +1,110 @@
|
|
1
|
+
/*
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
4
|
+
* distributed with this work for additional information
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
7
|
+
* "License"); you may not use this file except in compliance
|
8
|
+
* with the License. You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
13
|
+
* software distributed under the License is distributed on an
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
* KIND, either express or implied. See the License for the
|
16
|
+
* specific language governing permissions and limitations
|
17
|
+
* under the License.
|
18
|
+
*/
|
19
|
+
* {
|
20
|
+
-webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
|
21
|
+
}
|
22
|
+
|
23
|
+
body {
|
24
|
+
-webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */
|
25
|
+
-webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */
|
26
|
+
-webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */
|
27
|
+
background-color:#E4E4E4;
|
28
|
+
background-image:linear-gradient(to bottom, #A7A7A7 0%, #E4E4E4 51%);
|
29
|
+
font-family: system-ui, -apple-system, -apple-system-font, 'Segoe UI', 'Roboto', sans-serif;
|
30
|
+
font-size:12px;
|
31
|
+
height:100vh;
|
32
|
+
margin:0px;
|
33
|
+
padding:0px;
|
34
|
+
/* Padding to avoid the "unsafe" areas behind notches in the screen */
|
35
|
+
padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
|
36
|
+
text-transform:uppercase;
|
37
|
+
width:100%;
|
38
|
+
}
|
39
|
+
|
40
|
+
/* Portrait layout (default) */
|
41
|
+
.app {
|
42
|
+
background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */
|
43
|
+
position:absolute; /* position in the center of the screen */
|
44
|
+
left:50%;
|
45
|
+
top:50%;
|
46
|
+
height:50px; /* text area height */
|
47
|
+
width:225px; /* text area width */
|
48
|
+
text-align:center;
|
49
|
+
padding:180px 0px 0px 0px; /* image height is 200px (bottom 20px are overlapped with text) */
|
50
|
+
margin:-115px 0px 0px -112px; /* offset vertical: half of image height and text area height */
|
51
|
+
/* offset horizontal: half of text area width */
|
52
|
+
}
|
53
|
+
|
54
|
+
/* Landscape layout (with min-width) */
|
55
|
+
@media screen and (min-aspect-ratio: 1/1) and (min-width:400px) {
|
56
|
+
.app {
|
57
|
+
background-position:left center;
|
58
|
+
padding:75px 0px 75px 170px; /* padding-top + padding-bottom + text area = image height */
|
59
|
+
margin:-90px 0px 0px -198px; /* offset vertical: half of image height */
|
60
|
+
/* offset horizontal: half of image width and text area width */
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
h1 {
|
65
|
+
font-size:24px;
|
66
|
+
font-weight:normal;
|
67
|
+
margin:0px;
|
68
|
+
overflow:visible;
|
69
|
+
padding:0px;
|
70
|
+
text-align:center;
|
71
|
+
}
|
72
|
+
|
73
|
+
.event {
|
74
|
+
border-radius:4px;
|
75
|
+
color:#FFFFFF;
|
76
|
+
font-size:12px;
|
77
|
+
margin:0px 30px;
|
78
|
+
padding:2px 0px;
|
79
|
+
}
|
80
|
+
|
81
|
+
.event.listening {
|
82
|
+
background-color:#333333;
|
83
|
+
display:block;
|
84
|
+
}
|
85
|
+
|
86
|
+
.event.received {
|
87
|
+
background-color:#4B946A;
|
88
|
+
display:none;
|
89
|
+
}
|
90
|
+
|
91
|
+
#deviceready.ready .event.listening { display: none; }
|
92
|
+
#deviceready.ready .event.received { display: block; }
|
93
|
+
|
94
|
+
@keyframes fade {
|
95
|
+
from { opacity: 1.0; }
|
96
|
+
50% { opacity: 0.4; }
|
97
|
+
to { opacity: 1.0; }
|
98
|
+
}
|
99
|
+
|
100
|
+
.blink {
|
101
|
+
animation:fade 3000ms infinite;
|
102
|
+
-webkit-animation:fade 3000ms infinite;
|
103
|
+
}
|
104
|
+
|
105
|
+
|
106
|
+
@media screen and (prefers-color-scheme: dark) {
|
107
|
+
body {
|
108
|
+
background-image:linear-gradient(to bottom, #585858 0%, #1B1B1B 51%);
|
109
|
+
}
|
110
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<script type="text/javascript" src="cordova.js"></script>
|
4
|
+
<script src="js/appOpenAd.js" defer></script>
|
5
|
+
<script src="js/bannerAd.js" defer></script>
|
6
|
+
<script src="js/interstitialAd.js" defer></script>
|
7
|
+
<script src="js/rewardedAd.js" defer></script>
|
8
|
+
<script src="js/deviceready.js" defer></script>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
|
12
|
+
<label for="event">Debug Event All response :</label>
|
13
|
+
<textarea id="log" name="log" rows="5" cols="40"></textarea>
|
14
|
+
|
15
|
+
<p> <button onclick="loadAppOpen();">Auto Show App Open Ad</button></p>
|
16
|
+
|
17
|
+
|
18
|
+
<p> <button onclick="loadInterstitial();">Load Interstitial Ad</button></p>
|
19
|
+
<p> <button onclick="showInterstitial();">Show Interstitial Ad</button></p>
|
20
|
+
|
21
|
+
<p> <button onclick="loadRewarded();">Load Rewarded Ad</button></p>
|
22
|
+
<p> <button onclick="showRewarded();">Show Rewarded Ad</button></p>
|
23
|
+
|
24
|
+
<p> <button onclick="cleanText();">Clean response Text</button></p>
|
25
|
+
|
26
|
+
</body>
|
27
|
+
</html>
|
@@ -0,0 +1,146 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
/*
|
4
|
+
|
5
|
+
Best practices
|
6
|
+
App open ads help you monetize your app's loading screen, when the app first launches and during app switches,
|
7
|
+
but it's important to keep best practices in mind so that your users enjoy using your app. It's best to:
|
8
|
+
|
9
|
+
Show your first app open ad after your users have used your app a few times.
|
10
|
+
Show app open ads during times when your users would otherwise be waiting for your app to load.
|
11
|
+
If you have a loading screen under the app open ad,
|
12
|
+
and your loading screen completes loading before the ad is dismissed,
|
13
|
+
you may want to dismiss your loading screen in the on.appOpenAd.dismissed method.
|
14
|
+
|
15
|
+
*/
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
let isAppOpenAdLoad = false;
|
25
|
+
|
26
|
+
function loadAppOpen() {
|
27
|
+
|
28
|
+
if (typeof cordova !== 'undefined') {
|
29
|
+
cordova.plugins.emiAdmobPlugin.loadAppOpenAd({ adUnitId: App_Open_ID, autoShow: true });
|
30
|
+
}
|
31
|
+
|
32
|
+
}
|
33
|
+
|
34
|
+
|
35
|
+
/*
|
36
|
+
function showAppOpen() {
|
37
|
+
|
38
|
+
if (typeof cordova !== 'undefined') {
|
39
|
+
if (isAppOpenAdLoad) {
|
40
|
+
cordova.plugins.emiAdmobPlugin.showAppOpenAd();
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
}
|
45
|
+
|
46
|
+
*/
|
47
|
+
|
48
|
+
|
49
|
+
/*
|
50
|
+
on.appOpenAd.loaded
|
51
|
+
on.appOpenAd.failed.loaded
|
52
|
+
on.appOpenAd.dismissed
|
53
|
+
on.appOpenAd.failed.show
|
54
|
+
on.appOpenAd.show
|
55
|
+
|
56
|
+
// New event plugin v1.5.5 or higher
|
57
|
+
|
58
|
+
on.appOpenAd.revenue
|
59
|
+
on.appOpenAd.responseInfo
|
60
|
+
|
61
|
+
|
62
|
+
*/
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
document.addEventListener('on.appOpenAd.loaded', () => {
|
67
|
+
isAppOpenAdLoad = true;
|
68
|
+
console.log("on.appOpenAd.loaded");
|
69
|
+
window.log.value += ("\n on.appOpenAd.loaded");
|
70
|
+
});
|
71
|
+
|
72
|
+
|
73
|
+
document.addEventListener('on.appOpenAd.failed.loaded', (error) => {
|
74
|
+
isAppOpenAdLoad = false;
|
75
|
+
console.log("on.appOpenAd.failed.loaded" + JSON.stringify(error));
|
76
|
+
|
77
|
+
window.log.value += ("\n on.appOpenAd.failed.loaded" + JSON.stringify(error));
|
78
|
+
});
|
79
|
+
|
80
|
+
|
81
|
+
document.addEventListener('on.appOpenAd.failed.show', (error) => {
|
82
|
+
isAppOpenAdLoad = false;
|
83
|
+
console.log("on.appOpenAd.failed.show" + JSON.stringify(error));
|
84
|
+
|
85
|
+
window.log.value += ("\n on.appOpenAd.failed.show" + JSON.stringify(error));
|
86
|
+
});
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
// all events that contain the keyword dismissed there is a block to load the ad after it is closed by the user.
|
91
|
+
document.addEventListener('on.appOpenAd.dismissed', () => {
|
92
|
+
// Stop loading the app, go straight to the main menu of the app.
|
93
|
+
isAppOpenAdLoad = false;
|
94
|
+
console.log("Stop loading the app, go straight to the main menu of the app.");
|
95
|
+
console.log("you can load ads automatically after the ads are closed by users");
|
96
|
+
|
97
|
+
|
98
|
+
window.log.value += ("\n you can load ads automatically after the ads are closed by users");
|
99
|
+
|
100
|
+
});
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
/*
|
113
|
+
// DEBUG
|
114
|
+
// isResponseInfo: true, // debug Default false
|
115
|
+
document.addEventListener('on.appOpenAd.responseInfo', (data) => {
|
116
|
+
|
117
|
+
console.log("on.appOpenAd.responseInfo" + JSON.stringify(data));
|
118
|
+
if (window.log) window.log.value += ("\n on.appOpenAd.responseInfo" + JSON.stringify(data));
|
119
|
+
});
|
120
|
+
|
121
|
+
*/
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
/*
|
128
|
+
https://support.google.com/admob/answer/11322405
|
129
|
+
|
130
|
+
Turn on the setting for impression-level ad revenue in your AdMob account:
|
131
|
+
Sign in to your AdMob account at https://apps.admob.com.
|
132
|
+
Click Settings in the sidebar.
|
133
|
+
Click the Account tab.
|
134
|
+
In the Account controls section, click the Impression-level ad revenue toggle to turn on this setting.
|
135
|
+
*/
|
136
|
+
|
137
|
+
document.addEventListener('on.appOpenAd.revenue', (data) => {
|
138
|
+
|
139
|
+
console.log(data.value)
|
140
|
+
console.log(data.currencyCode)
|
141
|
+
console.log(data.precision)
|
142
|
+
console.log(data.adUnitId)
|
143
|
+
|
144
|
+
// console.log("on.appOpenAd.revenue" + JSON.stringify(data));
|
145
|
+
if (window.log) window.log.value += ("\n on.appOpenAd.revenue" + JSON.stringify(data));
|
146
|
+
});
|