emi-indo-cordova-plugin-admob 1.4.2 → 1.4.4

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.
@@ -12,12 +12,15 @@
12
12
  let event = document.getElementById('event');
13
13
 
14
14
  let cleanText = () => { event.value = '' };
15
-
16
- let debug = false;
17
-
18
15
  /*
19
- >>>>>>>>>> Banner position <<<<<<<<<<<<<<
20
16
 
17
+
18
+ >>>>>>>>>>> Banner collapsible position <<<<<<<<<<<<
19
+ top-center
20
+ bottom-center
21
+
22
+
23
+ >>>>>>>>>>> Banner position <<<<<<<<<<<<
21
24
  top-right
22
25
  top-center
23
26
  left
@@ -29,10 +32,10 @@ bottom-right
29
32
  >>>>>>>>>>> Banner size <<<<<<<<<<<<
30
33
  ( Ad Size Adaptive )
31
34
 
32
- Anchored_adaptive
33
- Inline_adaptive
34
- default: Adaptive_FULL_WIDTH
35
- adaptiveWidth = number/default = 320
35
+ ANCHORED
36
+ IN_LINE
37
+ FULL_WIDTH
38
+ adaptive_Width = 320
36
39
 
37
40
  ( Ad Size not Adaptive )
38
41
 
@@ -43,79 +46,34 @@ MEDIUM_RECTANGLE
43
46
  FULL_BANNER
44
47
  LEADERBOARD
45
48
 
46
- Smart Banners = DEPRECATED ( Replaced by Adaptive_FULL_WIDTH )
47
-
48
49
  */
49
50
 
50
- // // Note adaptiveWidth = 320, // This is special size = "Inline_adaptive" or "Anchored_adaptive" if else this field will be ignored
51
51
 
52
- // Adaptive banner
52
+ // WARNING config must be an array[] not an object{}
53
+ const bannerConfig = [
53
54
 
54
- let loadBannerAdaptive = () => {
55
+ adUnitId = "ca-app-pub-3940256099942544/6300978111",
56
+ position = "bottom-center",
57
+ size = "BANNER",
58
+ collapsible = "bottom", // (BETA) enable in globalSettings
59
+ adaptive_Width = 320, // Ignored
60
+ autoShow = true // boolean
55
61
 
56
- cordova.plugins.emiAdmobPlugin.loadBannerAd(
57
- AdUnitId = "ca-app-pub-3940256099942544/6300978111",
58
- npa = "1", // String | 0 | 1
59
- position = "bottom-center",
60
- size = "default", // Inline_adaptive | Anchored_adaptive | default = Adaptive_FULL_WIDTH
61
- adaptiveWidth = 320,
62
- responseInfo = debug, // boolean
62
+ ]
63
63
 
64
- (info) => {
65
-
66
- if (debug === true) {
67
-
68
- event.value += "\n ResponseInfo: " + info; // responseInfo = true
69
-
70
- }
71
-
72
- },
73
- (error) => {
74
-
75
- event.value += "\n Error: " + error
76
-
77
- });
78
- }
79
-
80
-
81
-
82
- // not Adaptive banner
83
-
84
- let loadBannerNotAdaptive = () => {
85
- cordova.plugins.emiAdmobPlugin.loadBannerAd(
86
- AdUnitId = "ca-app-pub-3940256099942544/6300978111",
87
- npa = "1", // String | 0 | 1
88
- position = "bottom-center",
89
- size = "BANNER",
90
- adaptiveWidth = 320, // Ignored
91
- responseInfo = false, // boolean
92
-
93
-
94
- (info) => {
95
-
96
- if (debug === true) {
97
-
98
- event.value += "\n ResponseInfo: " + info; // responseInfo = true
99
-
100
- }
101
-
102
- },
103
- (error) => {
104
-
105
- event.value += "\n Error: " + error
106
64
 
107
- });
65
+ // load banner ad
66
+ let loadBannerAd = () => {
67
+ cordova.plugins.emiAdmobPlugin.loadBannerAd(bannerConfig);
68
+ // call loadBannerAd();
108
69
  }
109
70
 
110
-
111
-
112
71
  // show Banner Ad
113
-
114
72
  let showBannerAd = () => {
115
73
 
116
- cordova.plugins.emiAdmobPlugin.showBannerAd(
117
-
118
- (info) => {
74
+ cordova.plugins.emiAdmobPlugin.showBannerAd((info) => {
75
+ document.body.style.height= '93vh';
76
+ document.body.style.background= 'black';
119
77
  // event name: on.banner.revenue
120
78
  event.value += "\n Micros: " + info.micros;
121
79
  event.value += "\n Currency: " + info.currency;
@@ -128,14 +86,19 @@ let showBannerAd = () => {
128
86
  event.value += "\n Error: " + error
129
87
 
130
88
  });
131
-
89
+ // call showBannerAd();
132
90
  }
133
91
 
92
+ // Hide Banner Ad
93
+ let hideBannerAd = () => {
94
+ cordova.plugins.emiAdmobPlugin.hideBannerAd();
95
+ // call hideBannerAd();
96
+ }
134
97
 
135
98
  // Remove Banner
136
-
137
99
  let removeBannerAd = () => {
138
100
  cordova.plugins.emiAdmobPlugin.removeBannerAd();
101
+ // call removeBannerAd();
139
102
  }
140
103
 
141
104
 
@@ -144,42 +107,38 @@ let removeBannerAd = () => {
144
107
 
145
108
  document.addEventListener("deviceready", function(){
146
109
 
147
- // Before loading ads, have your app initialize the Google Mobile Ads SDK by calling
148
- // This needs to be done only once, ideally at app launch.
149
110
 
150
- cordova.plugins.emiAdmobPlugin.initialize(
151
- // Optional
152
- (info) => {
153
- event.value += (info)
154
- },
155
- (error) => {
111
+ const config_globalSettings = [
112
+
113
+
114
+ // DEPRECATED enableSameAppKey
115
+ setAppMuted = false, // Type Boolean default: false
116
+ setAppVolume = 1.0, // Type float default: 1
117
+ publisherFirstPartyIdEnabled = true, // Type Boolean default: true // enableSameAppKey
118
+ npa = "1", // string "0" | "1" // DEPRECATED Beginning January 16, 2024
119
+ enableCollapsible = true, // (BETA) activate the collapsible banner ads
120
+ responseInfo = false, // For debugging and logging purposes
121
+
122
+ ]
123
+
124
+ cordova.plugins.emiAdmobPlugin.globalSettings(config_globalSettings);
125
+
126
+
127
+ // Must be under globalSetting and targeting
128
+ cordova.plugins.emiAdmobPlugin.initialize();
129
+
156
130
 
157
- event.value += (error)
158
131
 
159
- });
160
132
 
161
133
  // SDK EVENT Initialization
162
-
134
+ // Optional
163
135
  document.addEventListener('on.sdkInitialization', () => {
164
136
 
165
137
  event.value += ("\n On Sdk Initialization");
166
138
 
167
-
168
139
  });
169
140
 
170
141
 
171
- // Banner Ad EVENT
172
-
173
- /*
174
- on.banner.load
175
- on.banner.failed.load
176
- on.banner.click
177
- on.banner.close
178
- on.banner.impression
179
- on.banner.open
180
- on.banner.revenue
181
- on.banner.remove
182
- */
183
142
 
184
143
 
185
144
  document.addEventListener('on.banner.load', () => {
@@ -231,18 +190,24 @@ event.value += ("\n on.banner.remove");
231
190
  });
232
191
 
233
192
 
193
+
234
194
  }, false);
235
195
 
236
196
  </script>
237
197
 
238
- <p> <button onclick="loadBannerAdaptive();">load Banner adaptive</button></p>
239
- <p> <button onclick="loadBannerNotAdaptive();">load Banner No Adaptive</button></p>
198
+
199
+
200
+ <p> <button onclick="loadBannerAd();">load Banner Ad</button></p>
240
201
  <p> <button onclick="showBannerAd();">show Banner Ad</button></p>
202
+ <p> <button onclick="hideBannerAd();">hide Banner Ad</button></p>
241
203
  <p> <button onclick="removeBannerAd();">remove Banner Ad</button></p>
204
+ <p> <button onclick="hideBannerAd();">hide Banner Ad</button></p>
205
+
242
206
 
243
207
 
244
208
  <p> <button onclick="cleanText();">Clean response Text</button></p>
245
209
 
246
210
 
211
+
247
212
  </body>
248
213
  </html>
@@ -12,50 +12,30 @@
12
12
  let event = document.getElementById('event');
13
13
 
14
14
  let cleanText = () => { event.value = '' };
15
-
16
- let debug = false;
17
15
 
18
16
 
17
+ // WARNING config must be an array[] not an object{}
18
+ const config_Interstitial = [
19
+
20
+ adUnitId = "ca-app-pub-3940256099942544/1033173712",
21
+ autoShow = true
22
+
23
+ ]
24
+
19
25
 
20
- // Load Interstitial Ad
21
26
 
27
+ // Load Interstitial Ad
22
28
  let loadInterstitialAd = () => {
23
- cordova.plugins.emiAdmobPlugin.loadInterstitialAd(
24
- AdUnitId = "ca-app-pub-3940256099942544/1033173712",
25
- npa = "1", // String | 0 | 1
26
- responseInfo = debug, // boolean
27
-
28
- (info) => {
29
-
30
- if (debug === true) {
31
-
32
- event.value += "\n ResponseInfo: " + info; // responseInfo = true
33
-
34
- } else
35
- if (debug === false) {
36
-
37
- // responseInfo = false
38
- // event name: on.interstitial.revenue
39
-
40
- event.value += "\n Micros: " + info.micros;
41
- event.value += "\n Currency: " + info.currency;
42
- event.value += "\n Precision: " + info.precision;
43
- event.value += "\n AdUnitId: " + info.adUnitId;
44
-
45
- }
46
-
47
- },
48
- (error) => {
49
-
50
- event.value += "\n Error: " + error
51
-
52
- });
29
+ cordova.plugins.emiAdmobPlugin.loadInterstitialAd(config_Interstitial);
30
+ // Or like this
31
+ // cordova.plugins.emiAdmobPlugin.loadInterstitialAd([adUnitId = "ca-app-pub-3940256099942544/1033173712", autoShow = false ]);
32
+ // call loadInterstitialAd();
53
33
  }
54
34
 
55
35
  // Show Interstitial Ad
56
-
57
36
  let showInterstitialAd = () => {
58
37
  cordova.plugins.emiAdmobPlugin.showInterstitialAd();
38
+ // call showInterstitialAd();
59
39
  }
60
40
 
61
41
 
@@ -63,20 +43,24 @@ let showInterstitialAd = () => {
63
43
 
64
44
 
65
45
  document.addEventListener("deviceready", function(){
46
+ // WARNING config must be an array[] not an object{}
47
+ const config_globalSettings = [
48
+
49
+ // DEPRECATED enableSameAppKey
50
+ setAppMuted = false, // Type Boolean default: false
51
+ setAppVolume = 1.0, // Type float default: 1
52
+ publisherFirstPartyIdEnabled = true, // Type Boolean default: true // enableSameAppKey
53
+ npa = "1", // string "0" | "1" // DEPRECATED Beginning January 16, 2024
54
+ enableCollapsible = true, // (BETA) activate the collapsible banner ads
55
+ responseInfo = false, // For debugging and logging purposes
66
56
 
67
- // Before loading ads, have your app initialize the Google Mobile Ads SDK by calling
68
- // This needs to be done only once, ideally at app launch.
57
+ ]
69
58
 
70
- cordova.plugins.emiAdmobPlugin.initialize(
71
- // Optional
72
- (info) => {
73
- event.value += (info)
74
- },
75
- (error) => {
59
+ cordova.plugins.emiAdmobPlugin.globalSettings(config_globalSettings);
76
60
 
77
- event.value += (error)
78
61
 
79
- });
62
+ // Must be under globalSetting and targeting
63
+ cordova.plugins.emiAdmobPlugin.initialize();
80
64
 
81
65
  // SDK EVENT Initialization
82
66
 
@@ -13,52 +13,31 @@
13
13
 
14
14
  let cleanText = () => { event.value = '' };
15
15
 
16
- let debug = false;
16
+
17
+
18
+
19
+ // WARNING config must be an array[] not an object{}
20
+ const config_rewarded = [
17
21
 
22
+ adUnitId = "ca-app-pub-3940256099942544/5224354917",
23
+ autoShow = true
18
24
 
25
+ ]
19
26
 
20
- // Load Rewarded Ad
21
27
 
22
28
 
29
+ // Load Rewarded Ad
23
30
  let loadRewardedAd = () => {
24
- cordova.plugins.emiAdmobPlugin.loadRewardedAd(
25
- AdUnitId = "ca-app-pub-3940256099942544/5224354917",
26
- npa = "1", // String | 0 | 1
27
- responseInfo = debug, // boolean
28
-
29
-
30
- (info) => {
31
-
32
- if (debug === true) {
33
-
34
- event.value += "\n ResponseInfo: " + info; // responseInfo = true
35
-
36
- } else
37
- if (debug === false) {
38
-
39
- // responseInfo = false
40
- // event name: on.rewardedInt.revenue
41
-
42
- event.value += "\n Micros: " + info.micros;
43
- event.value += "\n Currency: " + info.currency;
44
- event.value += "\n Precision: " + info.precision;
45
- event.value += "\n AdUnitId: " + info.adUnitId;
46
-
47
- }
48
-
49
- },
50
- (error) => {
51
-
52
- event.value += "\n Error: " + error
53
-
54
- });
31
+ cordova.plugins.emiAdmobPlugin.loadRewardedAd(config_rewarded);
32
+ // Or like this
33
+ // cordova.plugins.emiAdmobPlugin.loadRewardedAd([adUnitId = "ca-app-pub-3940256099942544/5224354917", autoShow = false ]);
34
+ // call loadRewardedAd();
55
35
  }
56
36
 
57
37
  // Show Rewarded Ad
58
-
59
38
  let showRewardedAd = () => {
60
39
  cordova.plugins.emiAdmobPlugin.showRewardedAd();
61
-
40
+ // call showRewardedAd();
62
41
  }
63
42
 
64
43
 
@@ -67,19 +46,24 @@ let showRewardedAd = () => {
67
46
 
68
47
  document.addEventListener("deviceready", function(){
69
48
 
70
- // Before loading ads, have your app initialize the Google Mobile Ads SDK by calling
71
- // This needs to be done only once, ideally at app launch.
49
+ // WARNING config must be an array[] not an object{}
50
+ const config_globalSettings = [
51
+
52
+ // DEPRECATED enableSameAppKey
53
+ setAppMuted = false, // Type Boolean default: false
54
+ setAppVolume = 1.0, // Type float default: 1
55
+ publisherFirstPartyIdEnabled = true, // Type Boolean default: true // enableSameAppKey
56
+ npa = "1", // string "0" | "1" // DEPRECATED Beginning January 16, 2024
57
+ enableCollapsible = true, // (BETA) activate the collapsible banner ads
58
+ responseInfo = false, // For debugging and logging purposes
59
+
60
+ ]
72
61
 
73
- cordova.plugins.emiAdmobPlugin.initialize(
74
- // Optional
75
- (info) => {
76
- event.value += (info)
77
- },
78
- (error) => {
62
+ cordova.plugins.emiAdmobPlugin.globalSettings(config_globalSettings);
79
63
 
80
- event.value += (error)
81
64
 
82
- });
65
+ // Must be under globalSetting and targeting
66
+ cordova.plugins.emiAdmobPlugin.initialize();
83
67
 
84
68
  // SDK EVENT Initialization
85
69
 
@@ -13,51 +13,29 @@
13
13
 
14
14
  let cleanText = () => { event.value = '' };
15
15
 
16
- let debug = false;
16
+ // WARNING config must be an array[] not an object{}
17
+ const config_rewardedInt = [
17
18
 
19
+ adUnitId = "ca-app-pub-3940256099942544/5354046379",
20
+ autoShow = true
18
21
 
22
+ ]
19
23
 
20
- // load Rewarded Interstitial Ad
21
24
 
22
- let loadRewardedInterstitialAd = () => {
23
- cordova.plugins.emiAdmobPlugin.loadRewardedInterstitialAd(
24
- AdUnitId = "ca-app-pub-3940256099942544/5354046379",
25
- npa = "1", // String | 0 | 1
26
- responseInfo = debug, // boolean
27
-
28
- (info) => {
29
-
30
- if (debug === true) {
31
-
32
- event.value += "\n ResponseInfo: " + info; // responseInfo = true
33
-
34
- } else
35
- if (debug === false) {
36
-
37
- // responseInfo = false
38
- // event name: on.rewardedInt.revenue
39
-
40
- event.value += "\n Micros: " + info.micros;
41
- event.value += "\n Currency: " + info.currency;
42
- event.value += "\n Precision: " + info.precision;
43
- event.value += "\n AdUnitId: " + info.adUnitId;
44
-
45
- }
46
-
47
- },
48
- (error) => {
49
-
50
- event.value += "\n Error: " + error
51
-
52
- });
53
25
 
26
+ // load Rewarded Interstitial Ad
27
+ let loadRewardedInterstitialAd = () => {
28
+ cordova.plugins.emiAdmobPlugin.loadRewardedInterstitialAd(config_rewardedInt);
29
+ // Or like this
30
+ // cordova.plugins.emiAdmobPlugin.loadRewardedInterstitialAd([adUnitId = "ca-app-pub-3940256099942544/5354046379", autoShow = false ]);
31
+ // call loadRewardedInterstitialAd();
54
32
  }
55
33
 
56
34
 
57
35
  // Show Rewarded Interstitial Ad
58
-
59
36
  const showRewardedInterstitialAd = () => {
60
37
  cordova.plugins.emiAdmobPlugin.showRewardedInterstitialAd();
38
+ // call showRewardedInterstitialAd();
61
39
  }
62
40
 
63
41
 
@@ -66,19 +44,24 @@ const showRewardedInterstitialAd = () => {
66
44
 
67
45
  document.addEventListener("deviceready", function(){
68
46
 
69
- // Before loading ads, have your app initialize the Google Mobile Ads SDK by calling
70
- // This needs to be done only once, ideally at app launch.
47
+ // WARNING config must be an array[] not an object{}
48
+ const config_globalSettings = [
49
+
50
+ // DEPRECATED enableSameAppKey
51
+ setAppMuted = false, // Type Boolean default: false
52
+ setAppVolume = 1.0, // Type float default: 1
53
+ publisherFirstPartyIdEnabled = true, // Type Boolean default: true // enableSameAppKey
54
+ npa = "1", // string "0" | "1" // DEPRECATED Beginning January 16, 2024
55
+ enableCollapsible = true, // (BETA) activate the collapsible banner ads
56
+ responseInfo = false, // For debugging and logging purposes
57
+
58
+ ]
71
59
 
72
- cordova.plugins.emiAdmobPlugin.initialize(
73
- // Optional
74
- (info) => {
75
- event.value += (info)
76
- },
77
- (error) => {
60
+ cordova.plugins.emiAdmobPlugin.globalSettings(config_globalSettings);
78
61
 
79
- event.value += (error)
80
62
 
81
- });
63
+ // Must be under globalSetting and targeting
64
+ cordova.plugins.emiAdmobPlugin.initialize();
82
65
 
83
66
  // SDK EVENT Initialization
84
67
 
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emi-indo-cordova-plugin-admob",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "Cordova Plugin Admob Android IOS",
5
5
  "cordova": {
6
6
  "id": "emi-indo-cordova-plugin-admob",
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="1.4.2">
3
+ id="emi-indo-cordova-plugin-admob" version="1.4.4">
4
4
 
5
5
  <name>emiAdmobPlugin</name>
6
6
  <description>Cordova Plugin Admob Android IOS</description>
@@ -44,7 +44,7 @@
44
44
  <!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
45
45
 
46
46
  <preference name="APP_ID_ANDROID" default="ca-app-pub-3940256099942544~3347511713" />
47
- <preference name="PLAY_SERVICES_VERSION" default="22.5.0" />
47
+ <preference name="PLAY_SERVICES_VERSION" default="22.6.0" />
48
48
 
49
49
  <framework src="com.google.android.gms:play-services-ads:$PLAY_SERVICES_VERSION" />
50
50
 
@@ -299,7 +299,7 @@
299
299
  <source url="https://cdn.cocoapods.org/" />
300
300
  </config>
301
301
  <pods use-frameworks="true">
302
- <pod name="Google-Mobile-Ads-SDK" spec="~> 10.13.0" />
302
+ <pod name="Google-Mobile-Ads-SDK" spec="~> 10.14.0" />
303
303
  </pods>
304
304
  </podspec>
305
305