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.
@@ -15,63 +15,27 @@
15
15
 
16
16
  let cleanText = () => { event.value = '' };
17
17
 
18
- let debug = false;
19
-
20
-
21
-
22
18
  // Load Rewarded Ad
19
+ let loadRewardedAd = () => {
20
+ cordova.plugins.emiAdmobPlugin.loadRewardedAd([adUnitId = "ca-app-pub-3940256099942544/5224354917", autoShow = true ]);
21
+ // call loadRewardedAd();
22
+ }
23
23
 
24
+ // Show Rewarded Ad
25
+ let showRewardedAd = () => {
26
+ cordova.plugins.emiAdmobPlugin.showRewardedAd();
27
+ // call showRewardedAd();
28
+ }
24
29
 
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.
30
+ // >>>>>>>> User Messaging Platform (UMP) SDK 2.1.0
67
31
 
68
32
  let getConsentRequest = () => {
69
33
  // https://developers.google.com/admob/android/privacy
70
34
  cordova.plugins.emiAdmobPlugin.getConsentRequest(
71
35
 
72
- (info) => {
36
+ (ststus) => {
73
37
 
74
- event.value += "\n Consent Status: " + info;
38
+ event.value += "\n Consent Status: " + ststus;
75
39
 
76
40
  },
77
41
  (error) => {
@@ -164,19 +128,18 @@
164
128
 
165
129
  document.addEventListener("deviceready", function () {
166
130
 
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.
131
+
132
+ const config_Targeting = [
169
133
 
170
- cordova.plugins.emiAdmobPlugin.initialize(
171
- // Optional
172
- (info) => {
173
- event.value += (info)
174
- },
175
- (error) => {
134
+ childDirectedTreatment = 0, // value: 0 | -1 | 1
135
+ underAgeOfConsent = false, // default: false
136
+ contentRating = "G" // value: G | MA | PG | T | ""
176
137
 
177
- event.value += (error)
138
+ ]
178
139
 
179
- });
140
+
141
+ cordova.plugins.emiAdmobPlugin.targeting(config_Targeting);
142
+ cordova.plugins.emiAdmobPlugin.initialize();
180
143
 
181
144
 
182
145
  // Rewarded Ad EVENT
@@ -201,62 +164,7 @@
201
164
 
202
165
  });
203
166
 
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
-
167
+
260
168
 
261
169
  }, false);
262
170
 
@@ -6,35 +6,50 @@
6
6
 
7
7
  <script>
8
8
 
9
- // Installation
10
9
 
11
- // cordova plugin add emi-indo-cordova-plugin-consent
12
- // cordova plugin add emi-indo-cordova-plugin-admob
10
+ // >>>>>>>> User Messaging Platform (UMP) SDK 2.1.0
13
11
 
12
+ let getConsentStatus = () => {
13
+ // https://developers.google.com/admob/android/privacy
14
+ cordova.plugins.emiAdmobPlugin.getConsentRequest(
14
15
 
15
- let _getConsentRequest = () => {
16
- cordova.plugins.emiAdmobPlugin.getConsentRequest(
17
- // Setting Targeting in Device Ready
16
+ (ststus) => {
18
17
 
19
- (status) => { alert(status) }, // check event code
20
- (error) => { alert(error)
18
+ event.value += "\n Consent Status: " + ststus;
21
19
 
22
- });
23
- }
20
+ },
21
+ (error) => {
24
22
 
25
- // call _getConsentRequest();
23
+ event.value += "\n Error: " + error
26
24
 
25
+ });
27
26
 
27
+ }
28
28
 
29
- let _consentReset = () => {
30
- cordova.plugins.emiAdmobPlugin.consentReset();
31
- }
32
29
 
33
- // call _consentReset();
30
+ let consentReset = () => {
31
+ cordova.plugins.emiAdmobPlugin.consentReset();
32
+ }
34
33
 
35
34
 
36
35
 
36
+ // >>>>>>>> New features (UMP) SDK v2.1.0
37
+ let showPrivacyOptionsForm = () => {
37
38
 
39
+ cordova.plugins.emiAdmobPlugin.showPrivacyOptionsForm(
40
+
41
+ (info) => {
42
+
43
+ event.value += "\n Show Privacy Option Form: " + info;
44
+
45
+ },
46
+ (error) => {
47
+
48
+ event.value += "\n Error: " + error
49
+
50
+ });
51
+
52
+ }
38
53
 
39
54
 
40
55
 
@@ -42,19 +57,20 @@ let _consentReset = () => {
42
57
 
43
58
  document.addEventListener("deviceready", function(){
44
59
 
45
- cordova.plugins.emiAdmobPlugin.initialize();
60
+ // WARNING config must be an array[] not an object{}
61
+ const config_Targeting = [
46
62
 
47
- cordova.plugins.emiAdmobPlugin.targeting(
48
- TagForChildDirectedTreatment = 0, // value: 0 | -1 | 1
49
- TagForUnderAgeOfConsent = 0, // // value: 0 | -1 | 1
50
- MaxAdContentRating = "G", // value: G | MA | PG | T | ""
63
+ childDirectedTreatment = 0, // value: 0 | -1 | 1
64
+ underAgeOfConsent = false, // default: false
65
+ contentRating = "G" // value: G | MA | PG | T | ""
51
66
 
52
- // Optional
53
- (info) => { console.log(info)},
54
- (error) => { console.log(error)
67
+ ]
55
68
 
56
- });
57
-
69
+
70
+ cordova.plugins.emiAdmobPlugin.targeting(config_Targeting);
71
+
72
+ // Must be under globalSetting and targeting
73
+ cordova.plugins.emiAdmobPlugin.initialize();
58
74
 
59
75
 
60
76
 
@@ -63,10 +79,12 @@ cordova.plugins.emiAdmobPlugin.targeting(
63
79
 
64
80
 
65
81
 
66
- // Consent Event
67
82
 
83
+ // Optional Consent Event
68
84
 
69
85
  /*
86
+
87
+
70
88
  on.consent.info.update
71
89
  on.consent.info.update.failed
72
90
 
@@ -122,18 +140,12 @@ alert("Consent status is unknown.");
122
140
 
123
141
  });
124
142
 
125
-
126
-
127
-
128
-
129
-
130
-
131
143
  }, false);
132
144
  </script>
133
145
 
134
-
135
-
136
- <p> <button onclick="_getConsentRequest();">get Consent Request</button></p>
146
+ <p> <button onclick="getConsentStatus();">Get Consent Status</button></p>
147
+ <p> <button onclick="showPrivacyOptionsForm();">Show Privacy Options Form</button></p>
148
+ <p> <button onclick="consentReset();">Consent Reset</button></p>
137
149
 
138
150
  <p> <button onclick="_consentReset();">Consent reset</button></p>
139
151
 
@@ -15,21 +15,30 @@
15
15
 
16
16
  document.addEventListener("deviceready", function(){
17
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
18
 
21
- cordova.plugins.emiAdmobPlugin.initialize();
22
19
 
23
20
  // Instruction: https://developers.google.com/admob/android/global-settings
24
21
 
25
- cordova.plugins.emiAdmobPlugin.globalSettings(
22
+ // WARNING config must be an array[] not an object{}
23
+ const config_globalSettings = [
26
24
 
25
+ // DEPRECATED enableSameAppKey
27
26
  setAppMuted = false, // Type Boolean default: false
28
- setAppVolume = 1.0, // Type float
29
- enableSameAppKey = false // Type Boolean default: false
30
-
31
- });
27
+ setAppVolume = 1.0, // Type float default: 1
28
+ publisherFirstPartyIdEnabled = true, // Type Boolean default: true // enableSameAppKey
29
+ npa = "1", // string "0" | "1" // DEPRECATED Beginning January 16, 2024
30
+ enableCollapsible = true, // (BETA) activate the collapsible banner ads
31
+ responseInfo = false, // For debugging and logging purposes
32
+
33
+ ]
34
+
35
+ cordova.plugins.emiAdmobPlugin.globalSettings(config_globalSettings);
32
36
 
37
+ // Before loading ads, have your app initialize the Google Mobile Ads SDK by calling
38
+ // This needs to be done only once, ideally at app launch.
39
+
40
+ // Must be under globalSetting and targeting
41
+ cordova.plugins.emiAdmobPlugin.initialize();
33
42
 
34
43
  }, false);
35
44
  </script>
@@ -0,0 +1,59 @@
1
+ <html>
2
+ <head>
3
+ <script type="text/javascript" src="cordova.js"></script>
4
+ </head>
5
+ <body>
6
+
7
+ <script>
8
+
9
+
10
+
11
+ ///// >>>>>> Device Ready <<<<<<
12
+
13
+ document.addEventListener("deviceready", function(){
14
+
15
+ // WARNING config must be an array[] not an object{}
16
+ const config_Targeting = [
17
+
18
+ childDirectedTreatment = 0, // value: 0 | -1 | 1
19
+ underAgeOfConsent = false, // default: false
20
+ contentRating = "G" // value: G | MA | PG | T | ""
21
+
22
+ ]
23
+
24
+
25
+ cordova.plugins.emiAdmobPlugin.targeting(config_Targeting);
26
+
27
+ // Must be under globalSetting and targeting
28
+ cordova.plugins.emiAdmobPlugin.initialize();
29
+
30
+
31
+ // event
32
+ document.addEventListener('on.sdkInitialization', () => {
33
+
34
+ cordova.plugins.emiAdmobPlugin.requestIDFA(
35
+
36
+ (ststus) => {
37
+
38
+ event.value += "\n IDFA Status: " + ststus;
39
+
40
+ },
41
+ (error) => {
42
+
43
+ event.value += "\n Error: " + error
44
+
45
+ });
46
+
47
+
48
+ });
49
+
50
+
51
+
52
+
53
+ }, false);
54
+ </script>
55
+
56
+
57
+
58
+ </body>
59
+ </html>
@@ -7,36 +7,32 @@
7
7
  <script>
8
8
 
9
9
 
10
- // ### As suggested by Google, when the SDK initializes this plugin automatically takes the Global Settings and Targeting values.
11
-
12
10
  // ### Targeting
13
11
 
14
12
  ///// >>>>>> Device Ready <<<<<<
15
13
 
16
14
  document.addEventListener("deviceready", function(){
17
15
 
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
16
 
21
- cordova.plugins.emiAdmobPlugin.initialize();
17
+ // Instruction: https://developers.google.com/admob/android/targeting
18
+ // Overview: https://developers.google.com/android/reference/com/google/android/gms/ads/RequestConfiguration
22
19
 
23
- //(Auto Loaded during SDK initialize and ad loaded)
20
+ // WARNING config must be an array[] not an object{}
21
+ const config_Targeting = [
24
22
 
25
- // You can see the value when the ad is loaded, set responseInfo = true
23
+ childDirectedTreatment = 0, // value: 0 | -1 | 1
24
+ underAgeOfConsent = false, // default: false
25
+ contentRating = "G" // value: G | MA | PG | T | ""
26
+
27
+ ]
26
28
 
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
29
 
35
- // Optional
36
- (info) => { console.log(info)},
37
- (error) => { console.log(error)
30
+ cordova.plugins.emiAdmobPlugin.targeting(config_Targeting);
38
31
 
39
- });
32
+
33
+
34
+ // Must be under globalSetting and targeting
35
+ cordova.plugins.emiAdmobPlugin.initialize();
40
36
 
41
37
  // >>>>>>>>>>> Description <<<<<<<<<<<<<<<
42
38
 
@@ -49,16 +45,6 @@ cordova.plugins.emiAdmobPlugin.initialize();
49
45
  // -1 = UNSPECIFIED
50
46
  // (if else/undefined = false/0)
51
47
 
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
48
 
63
49
  //////////////////////////////
64
50
 
@@ -13,49 +13,26 @@
13
13
 
14
14
  let cleanText = () => { event.value = '' };
15
15
 
16
- let debug = false;
16
+
17
+ // WARNING config must be an array[] not an object{}
18
+ const config_AppOpenAd = [adUnitId = "ca-app-pub-3940256099942544/3419835294", autoShow = false ];
17
19
 
18
20
 
19
21
  // load App Open Ad
20
22
 
21
23
  let loadAppOpenAd = () => {
22
-
23
- cordova.plugins.emiAdmobPlugin.loadAppOpenAd(
24
- AdUnitId = "ca-app-pub-3940256099942544/3419835294",
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.appOpenAd.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
- });
24
+
25
+ cordova.plugins.emiAdmobPlugin.loadAppOpenAd(config_AppOpenAd);
26
+ // Or like this
27
+ // cordova.plugins.emiAdmobPlugin.loadAppOpenAd([adUnitId = "ca-app-pub-3940256099942544/3419835294", autoShow = false ]);
28
+ // call loadAppOpenAd();
53
29
  }
54
30
 
55
31
  // Show App Open Ad
56
32
 
57
33
  let showAppOpenAd = () => {
58
34
  cordova.plugins.emiAdmobPlugin.showAppOpenAd();
35
+ // call showAppOpenAd();
59
36
  }
60
37
 
61
38
 
@@ -64,20 +41,20 @@ let showAppOpenAd = () => {
64
41
 
65
42
  document.addEventListener("deviceready", function(){
66
43
 
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.
69
-
70
- cordova.plugins.emiAdmobPlugin.initialize(
71
- // Optional
72
- (info) => {
73
- event.value += (info)
74
- },
75
- (error) => {
44
+ const config_globalSettings = [
76
45
 
77
- event.value += (error)
46
+ // DEPRECATED enableSameAppKey
47
+ setAppMuted = false, // Type Boolean default: false
48
+ setAppVolume = 1.0, // Type float default: 1
49
+ publisherFirstPartyIdEnabled = true, // Type Boolean default: true // enableSameAppKey
50
+ npa = "1", // string "0" | "1" // DEPRECATED Beginning January 16, 2024
51
+ enableCollapsible = true, // (BETA) activate the collapsible banner ads
52
+ responseInfo = false, // For debugging and logging purposes
78
53
 
79
- });
54
+ ]
80
55
 
56
+ cordova.plugins.emiAdmobPlugin.globalSettings(config_globalSettings);
57
+ cordova.plugins.emiAdmobPlugin.initialize();
81
58
  // SDK EVENT Initialization
82
59
 
83
60
  document.addEventListener('on.sdkInitialization', () => {