cordova-plugin-admob-nextgen 1.0.8 → 1.0.9

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/README.md CHANGED
@@ -86,8 +86,14 @@ Add this to your `config.xml` to restore the plugin automatically.
86
86
  <variable name="APP_ID_IOS" value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy" />
87
87
  </plugin>
88
88
 
89
+ ---
90
+
91
+ ## (Optional)
89
92
 
90
- ## Supporting Mediation: **[⚡ admob-mediation-suite ](https://github.com/swaplab-engine/admob-mediation-suite)** (Optional)
93
+ ### Supporting Mediation: **[⚡ admob-mediation-suite ](https://github.com/swaplab-engine/admob-mediation-suite)** (Optional)
94
+ ### Supporting Native ads: **[⚡ cordova-plugin-admob-nextgen-native ](https://github.com/swaplab-engine/cordova-plugin-admob-nextgen-native)** (Optional)
95
+
96
+ ---
91
97
 
92
98
  ## For Capacitor users
93
99
  **[⚡ Capacitor Integration: Automated Setup for AdMob Next Gen ](https://github.com/swaplab-engine/cordova-plugin-admob-nextgen/discussions/3)**.
@@ -141,9 +147,10 @@ Add this to your `config.xml` to restore the plugin automatically.
141
147
  // 3. Initialize the SDK
142
148
  function startSdk() {
143
149
  admobNextGen.initialize({
144
- maxAdContentRating: 'G', // 'G' || 'PG' || 'T' || 'MA' || ""
145
- tagForChildDirectedTreatment: false,
146
- tagForUnderAgeOfConsent: false
150
+ maxAdContentRating: 'G', // 'G' | 'PG' | 'T' | 'MA' | ""
151
+ tagForChildDirectedTreatment: false, // true | false | null
152
+ tagForUnderAgeOfConsent: false, // true | false | null
153
+ // isNativeValidatorDisabled: false // optional param for: cordova-plugin-admob-nextgen-native
147
154
  }, function() {
148
155
  console.log(">>> AdMob SDK Initialized & Ready <<<");
149
156
  }, function(err) {
@@ -247,10 +254,12 @@ Supports **Adaptive**, **Standard**, and **Collapsible** banners.
247
254
 
248
255
  ## 4. Native Ads (Advanced Overlay) - Android Only
249
256
 
257
+ - Recommended: **[⚡ cordova-plugin-admob-nextgen-native ](https://github.com/swaplab-engine/cordova-plugin-admob-nextgen-native)** (Android | IOS)
258
+
250
259
  High-performance native templates.
251
260
 
252
261
  ### Example A: Using Templates (Recommended)
253
-
262
+ // Android Only
254
263
  admobNextGen.createNativeAd({
255
264
  adUnitId: 'ca-app-pub-xxx/xxx',
256
265
  view: 'banner_bottom', // Presets: 'banner_top', 'banner_bottom', 'modal_center'
@@ -259,7 +268,7 @@ High-performance native templates.
259
268
  });
260
269
 
261
270
  ### Example B: Custom Position (Manual Coordinates)
262
-
271
+ // Android Only
263
272
  admobNextGen.createNativeAd({
264
273
  adUnitId: 'ca-app-pub-xxx/xxx',
265
274
  view: 'custom',
@@ -271,7 +280,7 @@ High-performance native templates.
271
280
  });
272
281
 
273
282
  ### Native Methods & Events
274
-
283
+ // Android Only
275
284
  admobNextGen.removeNativeAd();
276
285
 
277
286
  document.addEventListener('on.native.loaded', () => console.log("Native Loaded"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-admob-nextgen",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Google Mobile Ads Next Gen SDK for Cordova. High performance and modular architecture. ",
5
5
  "cordova": {
6
6
  "id": "cordova-plugin-admob-nextgen",
package/plugin.xml CHANGED
@@ -1,6 +1,6 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
2
  <plugin id="cordova-plugin-admob-nextgen"
3
- version="1.0.8"
3
+ version="1.0.9"
4
4
  xmlns="http://apache.org/cordova/ns/plugins/1.0"
5
5
  xmlns:android="http://schemas.android.com/apk/res/android">
6
6
 
@@ -40,6 +40,8 @@ public class AdMobNextGen extends CordovaPlugin {
40
40
 
41
41
  private BannerPreloadExecutor bannerPreloadExecutor;
42
42
 
43
+ private boolean isNativeValidatorDisabled = true;
44
+
43
45
  @Override
44
46
  public void pluginInitialize() {
45
47
  super.pluginInitialize();
@@ -204,38 +206,45 @@ public class AdMobNextGen extends CordovaPlugin {
204
206
  }
205
207
 
206
208
  private void initializeSDK(JSONArray args, CallbackContext callbackContext) {
207
- String appId = getAppIdFromManifest();
208
- if (appId == null) {
209
- callbackContext.error("AdMob App ID missing");
210
- return;
211
- }
212
-
213
- cordova.getThreadPool().execute(() -> {
214
- try {
215
- InitializationConfig.Builder initConfigBuilder = new InitializationConfig.Builder(appId);
209
+ String appId = getAppIdFromManifest();
210
+ if (appId == null) {
211
+ callbackContext.error("AdMob App ID missing");
212
+ return;
213
+ }
216
214
 
217
- JSONObject configJson = args.optJSONObject(0);
215
+ cordova.getThreadPool().execute(() -> {
216
+ try {
217
+ InitializationConfig.Builder initConfigBuilder = new InitializationConfig.Builder(appId);
218
218
 
219
- if (configJson != null) {
219
+ JSONObject configJson = args.optJSONObject(0);
220
220
 
221
- RequestConfiguration requestConfig = GlobalSettingsExecutor.buildRequestConfiguration(configJson);
222
- initConfigBuilder.setRequestConfiguration(requestConfig);
223
- }
221
+ if (configJson != null) {
222
+ RequestConfiguration requestConfig = GlobalSettingsExecutor.buildRequestConfiguration(configJson);
223
+ initConfigBuilder.setRequestConfiguration(requestConfig);
224
224
 
225
- InitializationConfig config = initConfigBuilder.build();
225
+ this.isNativeValidatorDisabled = configJson.optBoolean("isNativeValidatorDisabled", true);
226
+ } else {
227
+ this.isNativeValidatorDisabled = false;
228
+ }
226
229
 
227
- MobileAds.initialize(
228
- cordova.getActivity(),
229
- config,
230
- initializationStatus -> {
231
- cordova.getActivity().runOnUiThread(() -> callbackContext.success("Initialized"));
232
- }
233
- );
234
- } catch (Exception e) {
235
- cordova.getActivity().runOnUiThread(() -> callbackContext.error(e.getMessage()));
230
+ if (this.isNativeValidatorDisabled) {
231
+ initConfigBuilder.setNativeValidatorDisabled();
236
232
  }
237
- });
238
- }
233
+
234
+ InitializationConfig config = initConfigBuilder.build();
235
+
236
+ MobileAds.initialize(
237
+ cordova.getActivity(),
238
+ config,
239
+ initializationStatus -> {
240
+ cordova.getActivity().runOnUiThread(() -> callbackContext.success("Initialized"));
241
+ }
242
+ );
243
+ } catch (Exception e) {
244
+ cordova.getActivity().runOnUiThread(() -> callbackContext.error(e.getMessage()));
245
+ }
246
+ });
247
+ }
239
248
 
240
249
  private String getAppIdFromManifest() {
241
250
  try {