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

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.
@@ -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', () => {
@@ -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,99 +46,45 @@ 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
-
52
- // Adaptive banner
53
-
54
- let loadBannerAdaptive = () => {
55
-
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
63
-
64
- (info) => {
65
-
66
- if (debug === true) {
67
-
68
- event.value += "\n ResponseInfo: " + info; // responseInfo = true
69
-
70
- }
71
-
72
- },
73
- (error) => {
74
51
 
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
52
+ // WARNING config must be an array[] not an object{}
53
+ const bannerConfig = [
92
54
 
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
93
61
 
94
- (info) => {
62
+ ]
95
63
 
96
- if (debug === true) {
97
-
98
- event.value += "\n ResponseInfo: " + info; // responseInfo = true
99
-
100
- }
101
64
 
102
- },
103
- (error) => {
104
-
105
- event.value += "\n Error: " + error
106
-
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) => {
119
- // event name: on.banner.revenue
120
- event.value += "\n Micros: " + info.micros;
121
- event.value += "\n Currency: " + info.currency;
122
- event.value += "\n Precision: " + info.precision;
123
- event.value += "\n AdUnitId: " + info.adUnitId;
124
-
125
- },
126
- (error) => {
127
-
128
- event.value += "\n Error: " + error
129
-
130
- });
131
-
74
+ cordova.plugins.emiAdmobPlugin.showBannerAd();
75
+ // call showBannerAd();
132
76
  }
133
77
 
78
+ // Hide Banner Ad
79
+ let hideBannerAd = () => {
80
+ cordova.plugins.emiAdmobPlugin.hideBannerAd();
81
+ // call hideBannerAd();
82
+ }
134
83
 
135
84
  // Remove Banner
136
-
137
85
  let removeBannerAd = () => {
138
86
  cordova.plugins.emiAdmobPlugin.removeBannerAd();
87
+ // call removeBannerAd();
139
88
  }
140
89
 
141
90
 
@@ -144,42 +93,38 @@ let removeBannerAd = () => {
144
93
 
145
94
  document.addEventListener("deviceready", function(){
146
95
 
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
96
 
150
- cordova.plugins.emiAdmobPlugin.initialize(
151
- // Optional
152
- (info) => {
153
- event.value += (info)
154
- },
155
- (error) => {
97
+ const config_globalSettings = [
98
+
99
+
100
+ // DEPRECATED enableSameAppKey
101
+ setAppMuted = false, // Type Boolean default: false
102
+ setAppVolume = 1.0, // Type float default: 1
103
+ publisherFirstPartyIdEnabled = true, // Type Boolean default: true // enableSameAppKey
104
+ npa = "1", // string "0" | "1" // DEPRECATED Beginning January 16, 2024
105
+ enableCollapsible = true, // (BETA) activate the collapsible banner ads
106
+ responseInfo = false, // For debugging and logging purposes
107
+
108
+ ]
109
+
110
+ cordova.plugins.emiAdmobPlugin.globalSettings(config_globalSettings);
111
+
112
+
113
+ // Must be under globalSetting and targeting
114
+ cordova.plugins.emiAdmobPlugin.initialize();
115
+
156
116
 
157
- event.value += (error)
158
117
 
159
- });
160
118
 
161
119
  // SDK EVENT Initialization
162
-
120
+ // Optional
163
121
  document.addEventListener('on.sdkInitialization', () => {
164
122
 
165
123
  event.value += ("\n On Sdk Initialization");
166
124
 
167
-
168
125
  });
169
126
 
170
127
 
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
128
 
184
129
 
185
130
  document.addEventListener('on.banner.load', () => {
@@ -231,18 +176,24 @@ event.value += ("\n on.banner.remove");
231
176
  });
232
177
 
233
178
 
179
+
234
180
  }, false);
235
181
 
236
182
  </script>
237
183
 
238
- <p> <button onclick="loadBannerAdaptive();">load Banner adaptive</button></p>
239
- <p> <button onclick="loadBannerNotAdaptive();">load Banner No Adaptive</button></p>
184
+
185
+
186
+ <p> <button onclick="loadBannerAd();">load Banner Ad</button></p>
240
187
  <p> <button onclick="showBannerAd();">show Banner Ad</button></p>
188
+ <p> <button onclick="hideBannerAd();">hide Banner Ad</button></p>
241
189
  <p> <button onclick="removeBannerAd();">remove Banner Ad</button></p>
190
+ <p> <button onclick="hideBannerAd();">hide Banner Ad</button></p>
191
+
242
192
 
243
193
 
244
194
  <p> <button onclick="cleanText();">Clean response Text</button></p>
245
195
 
246
196
 
197
+
247
198
  </body>
248
199
  </html>