emi-indo-cordova-plugin-admob 1.3.9 → 1.4.0

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.
@@ -1,94 +1,94 @@
1
- <html>
2
- <head>
3
- <script type="text/javascript" src="cordova.js"></script>
4
- </head>
5
- <body>
6
-
7
- <script>
8
-
9
-
10
- // For example automatically load Interstitial Ad
11
-
12
- // Load Interstitial Ad
13
-
14
- let loadInterstitialAd = () => {
15
- cordova.plugins.emiAdmobPlugin.loadInterstitialAd(
16
- AdUnitId = "ca-app-pub-3940256099942544/1033173712",
17
- npa = "1", // String | 0 | 1
18
- responseInfo = true, // boolean
19
-
20
- // Optional
21
- (info) => { alert(info) },
22
- (error) => { alert(error)
23
-
24
- });
25
-
26
- // call loadInterstitialAd();
27
- }
28
-
29
- // Show Interstitial Ad
30
-
31
- let showInterstitialAd = () => {
32
- cordova.plugins.emiAdmobPlugin.showInterstitialAd();
33
-
34
- // call showInterstitialAd();
35
- }
36
-
37
-
38
-
39
-
40
- // deviceready
41
-
42
- document.addEventListener("deviceready", function(){
43
-
44
- // Before loading ads, have your app initialize the Google Mobile Ads SDK by calling
45
- // This needs to be done only once, ideally at app launch.
46
-
47
- cordova.plugins.emiAdmobPlugin.initialize();
48
-
49
-
50
- // auto load call loadInterstitialAd();
51
-
52
- loadInterstitialAd();
53
-
54
-
55
-
56
-
57
- // Interstitial EVENT
58
-
59
- /*
60
- on.interstitial.loaded
61
- on.interstitial.failed.load
62
- on.interstitial.click
63
- on.interstitial.dismissed
64
- on.interstitial.failed.show
65
- on.interstitial.impression
66
- on.interstitial.show
67
- on.interstitial.revenue
68
- */
69
-
70
- document.addEventListener('on.interstitial.loaded', () => {
71
-
72
- // auto show call showInterstitialAd();
73
-
74
- showInterstitialAd();
75
-
76
- console.log("on Interstitial Ad Loaded");
77
-
78
- });
79
-
80
-
81
-
82
-
83
- }, false);
84
-
85
- </script>
86
-
87
-
88
- <p> <button onclick="loadInterstitialAd();">Load Interstitial Ad</button></p>
89
- <p> <button onclick="showInterstitialAd();">Show Interstitial Ad</button></p>
90
-
91
-
92
-
93
- </body>
94
- </html>
1
+ <html>
2
+ <head>
3
+ <script type="text/javascript" src="cordova.js"></script>
4
+ </head>
5
+ <body>
6
+
7
+ <script>
8
+
9
+
10
+ // For example automatically load Interstitial Ad
11
+
12
+ // Load Interstitial Ad
13
+
14
+ let loadInterstitialAd = () => {
15
+ cordova.plugins.emiAdmobPlugin.loadInterstitialAd(
16
+ AdUnitId = "ca-app-pub-3940256099942544/1033173712",
17
+ npa = "1", // String | 0 | 1
18
+ responseInfo = true, // boolean
19
+
20
+ // Optional
21
+ (info) => { alert(info) },
22
+ (error) => { alert(error)
23
+
24
+ });
25
+
26
+ // call loadInterstitialAd();
27
+ }
28
+
29
+ // Show Interstitial Ad
30
+
31
+ let showInterstitialAd = () => {
32
+ cordova.plugins.emiAdmobPlugin.showInterstitialAd();
33
+
34
+ // call showInterstitialAd();
35
+ }
36
+
37
+
38
+
39
+
40
+ // deviceready
41
+
42
+ document.addEventListener("deviceready", function(){
43
+
44
+ // Before loading ads, have your app initialize the Google Mobile Ads SDK by calling
45
+ // This needs to be done only once, ideally at app launch.
46
+
47
+ cordova.plugins.emiAdmobPlugin.initialize();
48
+
49
+
50
+ // auto load call loadInterstitialAd();
51
+
52
+ loadInterstitialAd();
53
+
54
+
55
+
56
+
57
+ // Interstitial EVENT
58
+
59
+ /*
60
+ on.interstitial.loaded
61
+ on.interstitial.failed.load
62
+ on.interstitial.click
63
+ on.interstitial.dismissed
64
+ on.interstitial.failed.show
65
+ on.interstitial.impression
66
+ on.interstitial.show
67
+ on.interstitial.revenue
68
+ */
69
+
70
+ document.addEventListener('on.interstitial.loaded', () => {
71
+
72
+ // auto show call showInterstitialAd();
73
+
74
+ showInterstitialAd();
75
+
76
+ console.log("on Interstitial Ad Loaded");
77
+
78
+ });
79
+
80
+
81
+
82
+
83
+ }, false);
84
+
85
+ </script>
86
+
87
+
88
+ <p> <button onclick="loadInterstitialAd();">Load Interstitial Ad</button></p>
89
+ <p> <button onclick="showInterstitialAd();">Show Interstitial Ad</button></p>
90
+
91
+
92
+
93
+ </body>
94
+ </html>
@@ -0,0 +1,279 @@
1
+ <html>
2
+
3
+ <head>
4
+ <script type="text/javascript" src="cordova.js"></script>
5
+ </head>
6
+
7
+ <body>
8
+
9
+ <label for="event">Debug Event All response :</label>
10
+ <textarea id="event" name="event" rows="15" cols="40"></textarea>
11
+
12
+ <script>
13
+
14
+ let event = document.getElementById('event');
15
+
16
+ let cleanText = () => { event.value = '' };
17
+
18
+ let debug = false;
19
+
20
+
21
+
22
+ // Load Rewarded Ad
23
+
24
+
25
+ let loadRewardedAd = () => {
26
+ cordova.plugins.emiAdmobPlugin.loadRewardedAd(
27
+ AdUnitId = "ca-app-pub-3940256099942544/5224354917",
28
+ npa = "1", // String | 0 | 1
29
+ responseInfo = debug, // boolean
30
+
31
+
32
+ (info) => {
33
+
34
+ if (debug === true) {
35
+
36
+ event.value += "\n ResponseInfo: " + info; // responseInfo = true
37
+
38
+ } else
39
+ if (debug === false) {
40
+
41
+ // responseInfo = false
42
+ // event name: on.rewardedInt.revenue
43
+
44
+ event.value += "\n Micros: " + info.micros;
45
+ event.value += "\n Currency: " + info.currency;
46
+ event.value += "\n Precision: " + info.precision;
47
+ event.value += "\n AdUnitId: " + info.adUnitId;
48
+
49
+ }
50
+
51
+ },
52
+ (error) => {
53
+
54
+ event.value += "\n Error: " + error
55
+
56
+ });
57
+ }
58
+
59
+ // Show Rewarded Ad
60
+
61
+ let showRewardedAd = () => {
62
+ cordova.plugins.emiAdmobPlugin.showRewardedAd();
63
+
64
+ }
65
+
66
+ // >>>>>>>> User Messaging Platform (UMP) SDK.
67
+
68
+ let getConsentRequest = () => {
69
+ // https://developers.google.com/admob/android/privacy
70
+ cordova.plugins.emiAdmobPlugin.getConsentRequest(
71
+
72
+ (info) => {
73
+
74
+ event.value += "\n Consent Status: " + info;
75
+
76
+ },
77
+ (error) => {
78
+
79
+ event.value += "\n Error: " + error
80
+
81
+ });
82
+
83
+ }
84
+
85
+
86
+ let consentReset = () => {
87
+ cordova.plugins.emiAdmobPlugin.consentReset();
88
+ }
89
+
90
+
91
+
92
+ // >>>>>>>> New features (UMP) SDK v2.1.0
93
+ let showPrivacyOptionsForm = () => {
94
+
95
+ cordova.plugins.emiAdmobPlugin.showPrivacyOptionsForm(
96
+
97
+ (info) => {
98
+
99
+ event.value += "\n Show Privacy Option Form: " + info;
100
+
101
+ },
102
+ (error) => {
103
+
104
+ event.value += "\n Error: " + error
105
+
106
+ });
107
+
108
+ }
109
+
110
+
111
+
112
+ /*
113
+ IAB Europe Transparency & Consent Framework
114
+ Final v.2.2 May 2023
115
+ */
116
+ // >>>>>>>> New features (UMP) SDK v2.1.0
117
+ // https://developers.google.com/admob/android/privacy/gdpr
118
+ let getIabTfc = () => {
119
+
120
+ cordova.plugins.emiAdmobPlugin.getIabTfc(
121
+ /*
122
+ If the user chooses not to display ads,
123
+ you can restrict access to the app, or ban it,
124
+ until they change their decision back,
125
+ Just call showPrivacyOptionsForm();
126
+ */
127
+ (info) => {
128
+ // How to read consent choices
129
+ event.value += "\n IABTCF_gdprApplies: " + info.IABTCF_gdprApplies;
130
+ event.value += "\n IABTCF_PurposeConsents: " + info.IABTCF_PurposeConsents; // In order for the ad to be displayed this must be filled in
131
+ event.value += "\n IABTCF_TCString: " + info.IABTCF_TCString; // In order for the ad to be displayed this must be filled in
132
+ /*
133
+ // A small example
134
+ var fundingChoices;
135
+
136
+ fundingChoices = info.IABTCF_PurposeConsents;
137
+ if (fundingChoices === "1111111111"){
138
+
139
+ // Enable app features.
140
+ loadRewardedAd();
141
+
142
+ } else if (fundingChoices === "") {
143
+
144
+ // disable app features.
145
+
146
+ } else {
147
+
148
+ // You have to test everything yourself.
149
+
150
+ }
151
+ */
152
+ },
153
+ (error) => {
154
+
155
+ event.value += "\n Error: " + error
156
+
157
+ });
158
+
159
+ }
160
+
161
+
162
+ ///// >>>>>> Device Ready <<<<<<
163
+
164
+
165
+ document.addEventListener("deviceready", function () {
166
+
167
+ // Before loading ads, have your app initialize the Google Mobile Ads SDK by calling
168
+ // This needs to be done only once, ideally at app launch.
169
+
170
+ cordova.plugins.emiAdmobPlugin.initialize(
171
+ // Optional
172
+ (info) => {
173
+ event.value += (info)
174
+ },
175
+ (error) => {
176
+
177
+ event.value += (error)
178
+
179
+ });
180
+
181
+
182
+ // Rewarded Ad EVENT
183
+
184
+ /*
185
+ on.rewarded.loaded
186
+ on.rewarded.failed.load
187
+ on.rewarded.click
188
+ on.rewarded.dismissed
189
+ on.rewarded.failed.show
190
+ on.rewarded.impression
191
+ on.rewarded.show
192
+ on.rewarded.revenue
193
+ on.rewarded.ad.skip
194
+ on.reward.userEarnedReward
195
+ */
196
+
197
+
198
+ document.addEventListener('on.rewarded.loaded', () => {
199
+
200
+ event.value += ("\n on.rewarded.loaded");
201
+
202
+ });
203
+
204
+ document.addEventListener('on.rewarded.failed.load', () => {
205
+
206
+ event.value += ("\n on.rewarded.failed.load");
207
+
208
+ });
209
+
210
+ document.addEventListener('on.rewarded.click', () => {
211
+
212
+ event.value += ("\n on.rewarded.click");
213
+
214
+ });
215
+
216
+ document.addEventListener('on.rewarded.dismissed', () => {
217
+
218
+ event.value += ("\n on.rewarded.dismissed");
219
+
220
+ });
221
+
222
+ document.addEventListener('on.rewarded.failed.show', () => {
223
+
224
+ event.value += ("\n on.rewarded.failed.show");
225
+
226
+ });
227
+
228
+ document.addEventListener('on.rewarded.impression', () => {
229
+
230
+ event.value += ("\n on.rewarded.impression");
231
+
232
+ });
233
+
234
+ document.addEventListener('on.rewarded.show', () => {
235
+
236
+ event.value += ("\n on.rewarded.show");
237
+
238
+ });
239
+
240
+ document.addEventListener('on.rewarded.revenue', () => {
241
+
242
+ event.value += ("\n on.rewarded.revenue");
243
+
244
+ });
245
+
246
+ document.addEventListener('on.rewarded.ad.skip', () => {
247
+
248
+ event.value += ("\n on.rewarded.ad.skip");
249
+
250
+ });
251
+
252
+
253
+ document.addEventListener('on.reward.userEarnedReward', () => {
254
+
255
+ event.value += ("\n on.reward.userEarnedReward");
256
+
257
+ });
258
+
259
+
260
+
261
+ }, false);
262
+
263
+ </script>
264
+
265
+ <p> <button onclick="getConsentRequest();">Get Consent Status</button></p>
266
+ <p> <button onclick="showPrivacyOptionsForm();">Show Privacy Options Form</button></p>
267
+ <p> <button onclick="getIabTfc();">Get IAB TFC Status</button></p>
268
+ <p> <button onclick="consentReset();">Consent Reset</button></p>
269
+
270
+ <p> <button onclick="loadRewardedAd();">Load Rewarded Ad</button></p>
271
+ <p> <button onclick="showRewardedAd();">Show Rewarded Ad</button></p>
272
+
273
+
274
+ <p> <button onclick="cleanText();">Clean response Text</button></p>
275
+
276
+
277
+ </body>
278
+
279
+ </html>
@@ -1,78 +1,78 @@
1
- <html>
2
- <head>
3
- <script type="text/javascript" src="cordova.js"></script>
4
- </head>
5
- <body>
6
-
7
- <script>
8
-
9
-
10
- // ### As suggested by Google, when the SDK initializes this plugin automatically takes the Global Settings and Targeting values.
11
-
12
- // ### Targeting
13
-
14
- ///// >>>>>> Device Ready <<<<<<
15
-
16
- document.addEventListener("deviceready", function(){
17
-
18
- // Before loading ads, have your app initialize the Google Mobile Ads SDK by calling
19
- // This needs to be done only once, ideally at app launch.
20
-
21
- cordova.plugins.emiAdmobPlugin.initialize();
22
-
23
- //(Auto Loaded during SDK initialize and ad loaded)
24
-
25
- // You can see the value when the ad is loaded, set responseInfo = true
26
-
27
- // Instruction: https://developers.google.com/admob/android/targeting
28
- // Overview: https://developers.google.com/android/reference/com/google/android/gms/ads/RequestConfiguration
29
-
30
- cordova.plugins.emiAdmobPlugin.targeting(
31
- TagForChildDirectedTreatment = 0, // value: 0 | -1 | 1
32
- TagForUnderAgeOfConsent = 0, // // value: 0 | -1 | 1
33
- MaxAdContentRating = "G", // value: G | MA | PG | T | ""
34
-
35
- // Optional
36
- (info) => { console.log(info)},
37
- (error) => { console.log(error)
38
-
39
- });
40
-
41
- // >>>>>>>>>>> Description <<<<<<<<<<<<<<<
42
-
43
- // (TagForChildDirectedTreatment)
44
- // Type number:
45
- // value: 0 | -1 | 1
46
- // (value description)
47
- // 0 = FALSE
48
- // 1 = TRUE
49
- // -1 = UNSPECIFIED
50
- // (if else/undefined = false/0)
51
-
52
- ///////////////////////////////
53
-
54
- // (TagForUnderAgeOfConsent)
55
- // Type number:
56
- // value: 0 | -1 | 1
57
- // (value description)
58
- // 0 = FALSE
59
- // 1 = TRUE
60
- // -1 = UNSPECIFIED
61
- // (if else/undefined = false/0)
62
-
63
- //////////////////////////////
64
-
65
- // (MaxAdContentRating)
66
- // Type String:
67
- // value: G | MA | PG | T | ""
68
- // (value description)
69
- // https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/max-ad-content-rating
70
- // (if else/undefined/"" = NULL)
71
-
72
-
73
- }, false);
74
- </script>
75
-
76
-
77
- </body>
78
- </html>
1
+ <html>
2
+ <head>
3
+ <script type="text/javascript" src="cordova.js"></script>
4
+ </head>
5
+ <body>
6
+
7
+ <script>
8
+
9
+
10
+ // ### As suggested by Google, when the SDK initializes this plugin automatically takes the Global Settings and Targeting values.
11
+
12
+ // ### Targeting
13
+
14
+ ///// >>>>>> Device Ready <<<<<<
15
+
16
+ document.addEventListener("deviceready", function(){
17
+
18
+ // Before loading ads, have your app initialize the Google Mobile Ads SDK by calling
19
+ // This needs to be done only once, ideally at app launch.
20
+
21
+ cordova.plugins.emiAdmobPlugin.initialize();
22
+
23
+ //(Auto Loaded during SDK initialize and ad loaded)
24
+
25
+ // You can see the value when the ad is loaded, set responseInfo = true
26
+
27
+ // Instruction: https://developers.google.com/admob/android/targeting
28
+ // Overview: https://developers.google.com/android/reference/com/google/android/gms/ads/RequestConfiguration
29
+
30
+ cordova.plugins.emiAdmobPlugin.targeting(
31
+ TagForChildDirectedTreatment = 0, // value: 0 | -1 | 1
32
+ TagForUnderAgeOfConsent = 0, // // value: 0 | -1 | 1
33
+ MaxAdContentRating = "G", // value: G | MA | PG | T | ""
34
+
35
+ // Optional
36
+ (info) => { console.log(info)},
37
+ (error) => { console.log(error)
38
+
39
+ });
40
+
41
+ // >>>>>>>>>>> Description <<<<<<<<<<<<<<<
42
+
43
+ // (TagForChildDirectedTreatment)
44
+ // Type number:
45
+ // value: 0 | -1 | 1
46
+ // (value description)
47
+ // 0 = FALSE
48
+ // 1 = TRUE
49
+ // -1 = UNSPECIFIED
50
+ // (if else/undefined = false/0)
51
+
52
+ ///////////////////////////////
53
+
54
+ // (TagForUnderAgeOfConsent)
55
+ // Type number:
56
+ // value: 0 | -1 | 1
57
+ // (value description)
58
+ // 0 = FALSE
59
+ // 1 = TRUE
60
+ // -1 = UNSPECIFIED
61
+ // (if else/undefined = false/0)
62
+
63
+ //////////////////////////////
64
+
65
+ // (MaxAdContentRating)
66
+ // Type String:
67
+ // value: G | MA | PG | T | ""
68
+ // (value description)
69
+ // https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/max-ad-content-rating
70
+ // (if else/undefined/"" = NULL)
71
+
72
+
73
+ }, false);
74
+ </script>
75
+
76
+
77
+ </body>
78
+ </html>