emi-indo-cordova-plugin-admob 1.6.7 → 1.6.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
@@ -8,7 +8,7 @@
8
8
  - AdSense New [example ](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/blob/main/example/www/js/adSense.js)
9
9
 
10
10
 
11
- ### Mobile Ads SDK (Android: 23.5.0) [Release Notes:](https://developers.google.com/admob/android/rel-notes)
11
+ ### Mobile Ads SDK (Android: 23.6.0) [Release Notes:](https://developers.google.com/admob/android/rel-notes)
12
12
  ### User Messaging Platform (UMP Android: 3.1.0) [Release Notes:](https://developers.google.com/admob/android/privacy/release-notes)
13
13
 
14
14
  ### Mobile Ads SDK (IOS: 11.12.0) [Release Notes:](https://developers.google.com/admob/ios/rel-notes)
@@ -114,7 +114,8 @@ on.banner.hide
114
114
 
115
115
  // EVENT For example
116
116
 
117
- document.addEventListener('on.banner.load', () => {
117
+ document.addEventListener('on.banner.load', (arg) => {
118
+ let bannerAdHeight=arg.height;
118
119
  console.log("on banner load");
119
120
  });
120
121
 
@@ -80,8 +80,17 @@ document.addEventListener("deviceready", function () {
80
80
 
81
81
  cordova.plugins.emiAdmobPlugin.requestIDFA(); // requestTrackingAuthorization
82
82
 
83
- }
84
-
83
+ }
84
+
85
+
86
+ // deactivate Google's consent
87
+ /*
88
+ cordova.plugins.emiAdmobPlugin.metaData({
89
+
90
+ useCustomConsentManager: false // Default false only android
91
+
92
+ });
93
+ */
85
94
 
86
95
  // AdMob Sdk initialize
87
96
 
@@ -121,4 +130,4 @@ document.addEventListener("deviceready", function () {
121
130
 
122
131
 
123
132
 
124
- }, false);
133
+ }, false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emi-indo-cordova-plugin-admob",
3
- "version": "1.6.7",
3
+ "version": "1.6.9",
4
4
  "description": "Cordova Plugin Admob Android IOS Support Capacitor",
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.6.7">
3
+ id="emi-indo-cordova-plugin-admob" version="1.6.9">
4
4
 
5
5
  <name>emiAdmobPlugin</name>
6
6
  <description>Cordova Plugin Admob Android IOS</description>
@@ -40,10 +40,7 @@
40
40
  <uses-permission android:name="android.permission.INTERNET" />
41
41
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
42
42
  </config-file>
43
-
44
- <config-file parent="./application" target="AndroidManifest.xml">
45
- <property android:name="android.adservices.AD_SERVICES_CONFIG" android:resource="@xml/gma_ad_services_config" tools:replace="android:resource" />
46
- </config-file>
43
+
47
44
 
48
45
  <config-file target="AndroidManifest.xml" parent="/manifest/application">
49
46
  <activity
@@ -67,7 +64,7 @@
67
64
  <!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
68
65
 
69
66
  <preference name="APP_ID_ANDROID" default="ca-app-pub-3940256099942544~3347511713" />
70
- <preference name="PLAY_SERVICES_VERSION" default="23.5.0" />
67
+ <preference name="PLAY_SERVICES_VERSION" default="23.6.0" />
71
68
 
72
69
  <framework src="com.google.android.gms:play-services-ads:$PLAY_SERVICES_VERSION" />
73
70
 
@@ -309,4 +306,4 @@
309
306
  </podspec>
310
307
 
311
308
  </platform>
312
- </plugin>
309
+ </plugin>
@@ -1132,8 +1132,8 @@ class emiAdmobPlugin : CordovaPlugin() {
1132
1132
  editor.putString("IABTCF_TCString", consentString)
1133
1133
  editor.putLong(LAST_ACCESS_SUFFIX, System.currentTimeMillis())
1134
1134
  editor.apply()
1135
- val key = "IABTCF_TCString"
1136
- getString(key)
1135
+ //val key = "IABTCF_TCString"
1136
+ getString(consentString.toString())
1137
1137
  callbackContext.success(userInfoJson)
1138
1138
  cWebView!!.loadUrl("javascript:cordova.fireDocumentEvent('on.getIabTfc');")
1139
1139
  } catch (e: Exception) {
@@ -1523,7 +1523,11 @@ class emiAdmobPlugin : CordovaPlugin() {
1523
1523
  bannerOverlapping()
1524
1524
  }
1525
1525
 
1526
- cWebView!!.loadUrl("javascript:cordova.fireDocumentEvent('on.banner.load');")
1526
+ val bannerHeight= adSize.height;
1527
+
1528
+ val bannerLoadEventData = String.format(Locale.US, "{\"height\": %d}", bannerHeight)
1529
+
1530
+ cWebView!!.loadUrl("javascript:cordova.fireDocumentEvent('on.banner.load', $bannerLoadEventData);")
1527
1531
 
1528
1532
  val eventData = String.format(
1529
1533
  "{\"collapsible\": \"%s\"}",
@@ -1600,13 +1604,12 @@ class emiAdmobPlugin : CordovaPlugin() {
1600
1604
 
1601
1605
 
1602
1606
 
1603
-
1604
1607
  // fix https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/issues/26
1605
1608
  private fun bannerOverlapping() {
1606
1609
  if (bannerView != null && mActivity != null && cWebView != null) {
1607
1610
  mActivity!!.runOnUiThread {
1608
1611
  try {
1609
- val bannerHeightInPx = bannerView!!.height
1612
+ // val bannerHeightInPx = bannerView!!.height
1610
1613
  val displayMetrics = DisplayMetrics()
1611
1614
  mActivity!!.windowManager.defaultDisplay.getMetrics(displayMetrics)
1612
1615
  val screenHeightInPx = displayMetrics.heightPixels
@@ -1630,6 +1633,8 @@ class emiAdmobPlugin : CordovaPlugin() {
1630
1633
 
1631
1634
 
1632
1635
 
1636
+
1637
+
1633
1638
  private val bannerPaidAdListener = OnPaidEventListener { adValue ->
1634
1639
  val valueMicros = adValue.valueMicros
1635
1640
  val currencyCode = adValue.currencyCode
@@ -1787,7 +1792,7 @@ class emiAdmobPlugin : CordovaPlugin() {
1787
1792
  try {
1788
1793
  (brandSafetyUrls as ArrayList<String>).add(brandSafetyArr.getString(i))
1789
1794
  } catch (e: JSONException) {
1790
- e.printStackTrace();
1795
+ e.printStackTrace();
1791
1796
  }
1792
1797
  }
1793
1798
  }
@@ -1796,7 +1801,7 @@ class emiAdmobPlugin : CordovaPlugin() {
1796
1801
  this.ppIdVl = ppId
1797
1802
  this.cURLVl = ctURL
1798
1803
  } catch (e: JSONException) {
1799
- e.printStackTrace();
1804
+ e.printStackTrace();
1800
1805
  }
1801
1806
  }
1802
1807
 
@@ -1810,7 +1815,7 @@ class emiAdmobPlugin : CordovaPlugin() {
1810
1815
  }
1811
1816
  }
1812
1817
  } catch (e: JSONException) {
1813
- e.printStackTrace();
1818
+ e.printStackTrace();
1814
1819
  }
1815
1820
  }
1816
1821
 
@@ -2001,7 +2006,7 @@ class emiAdmobPlugin : CordovaPlugin() {
2001
2006
  }
2002
2007
  return sb.toString().uppercase(Locale.getDefault())
2003
2008
  } catch (ex: NoSuchAlgorithmException) {
2004
- // ex.printStackTrace();
2009
+ ex.printStackTrace();
2005
2010
  return null
2006
2011
  }
2007
2012
  }
@@ -1446,8 +1446,19 @@ BOOL isUsingAdManagerRequest = YES;
1446
1446
  NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
1447
1447
  [self fireEvent:@"" event:@"on.is.collapsible" withData:jsonString];
1448
1448
  }
1449
+
1450
+ // Get the banner height
1451
+ CGFloat bannerHeight = bannerView.bounds.size.height;
1452
+
1449
1453
 
1450
- [self fireEvent:@"" event:@"on.banner.load" withData:nil];
1454
+
1455
+ // Prepare height data for banner load event
1456
+ NSDictionary *bannerLoadData = @{@"height" : @(bannerHeight)};
1457
+ NSData *bannerLoadJsonData = [NSJSONSerialization dataWithJSONObject:bannerLoadData options:0 error:&error];
1458
+ NSString *bannerLoadJsonString = [[NSString alloc] initWithData:bannerLoadJsonData encoding:NSUTF8StringEncoding];
1459
+
1460
+ // Fire the banner load event with the height data
1461
+ [self fireEvent:@"" event:@"on.banner.load" withData:bannerLoadJsonString];
1451
1462
 
1452
1463
  if (auto_Show && self.bannerView) {
1453
1464
  [self addBannerViewToView:command];