emi-indo-cordova-plugin-admob 2.0.7 → 2.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 +6 -3
- package/example/package.json +1 -1
- package/example/www/js/bannerAd.js +4 -4
- package/package.json +1 -1
- package/plugin.xml +1 -1
- package/src/android/emiAdmobPlugin.kt +74 -234
- package/www/emiAdmobPlugin.js +1 -4
- package/.gitattributes +0 -2
- package/.github/FUNDING.yml +0 -13
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -127
package/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
### emi-indo-cordova-plugin-admob@2.0.
|
1
|
+
### emi-indo-cordova-plugin-admob@2.0.9
|
2
2
|
|
3
3
|
|
4
4
|
## Features/method
|
@@ -20,7 +20,7 @@
|
|
20
20
|
- setPersonalizationState
|
21
21
|
- setPPS
|
22
22
|
|
23
|
-
## new version of the plugin @2.0.
|
23
|
+
## new version of the plugin @2.0.8 or higher
|
24
24
|
- Migrate from Mobile Ads SDK (Android) v23 to v24
|
25
25
|
- Migrate from Mobile Ads SDK (iOS) SDK version v11 to v12
|
26
26
|
- Migrate from Cordova Android 13.0.0 to 14.0.0
|
@@ -30,11 +30,14 @@
|
|
30
30
|
- Check all release notes: https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/releases/
|
31
31
|
```
|
32
32
|
config.xml
|
33
|
-
<preference name="fullscreen" value="false" />
|
33
|
+
<preference name="fullscreen" value="false | true" />
|
34
34
|
<preference name="android-minSdkVersion" value="23" />
|
35
35
|
<preference name="android-targetSdkVersion" value="35" />
|
36
36
|
```
|
37
37
|
|
38
|
+
- VIDEO banner top-center: https://www.youtube.com/watch?v=uQrC0k3-VU8
|
39
|
+
- VIDEO banner bottom-center: https://www.youtube.com/watch?v=qqxxa2gi7OU
|
40
|
+
|
38
41
|
<h3>Screenshots banner ad no overlapping</h3>
|
39
42
|
|
40
43
|
<table>
|
package/example/package.json
CHANGED
@@ -11,8 +11,8 @@ function loadBanner() {
|
|
11
11
|
// Optional Only IOS
|
12
12
|
if (isPlatformIOS){
|
13
13
|
cordova.plugins.emiAdmobPlugin.styleBannerAd({
|
14
|
-
isOverlapping: true, // default false
|
15
|
-
paddingWebView: 1.0
|
14
|
+
isOverlapping: true, // default false
|
15
|
+
paddingWebView: 1.0
|
16
16
|
});
|
17
17
|
|
18
18
|
}
|
@@ -21,12 +21,12 @@ function loadBanner() {
|
|
21
21
|
|
22
22
|
cordova.plugins.emiAdmobPlugin.loadBannerAd({
|
23
23
|
adUnitId: Banner_ID, //Banner_ID,
|
24
|
-
position: "bottom-center", //
|
24
|
+
position: "bottom-center", // bottom-center | top-center
|
25
25
|
size: "banner",
|
26
26
|
collapsible: "", // position: top | bottom (disable, empty string)
|
27
27
|
autoShow: true, // default false
|
28
28
|
isOverlapping: false // The height of the body is reduced by the height of the banner.
|
29
|
-
|
29
|
+
// isOverlapping: true // The body height is not reduced, the banner overlaps on top of the body
|
30
30
|
});
|
31
31
|
|
32
32
|
|
package/package.json
CHANGED
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="2.0.
|
3
|
+
id="emi-indo-cordova-plugin-admob" version="2.0.9">
|
4
4
|
|
5
5
|
<name>emiAdmobPlugin</name>
|
6
6
|
<description>Cordova/Quasar/Capacitor Plugin Admob Android IOS</description>
|
@@ -96,7 +96,7 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
96
96
|
private var isStatusBarShow: Boolean = true
|
97
97
|
|
98
98
|
var adType = ""
|
99
|
-
|
99
|
+
private var bannerViewHeight: Int = 0
|
100
100
|
|
101
101
|
var isBannerLoad: Boolean = false
|
102
102
|
var isBannerShow: Boolean = false
|
@@ -152,8 +152,7 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
152
152
|
|
153
153
|
|
154
154
|
private var isFullScreen: Boolean = false
|
155
|
-
|
156
|
-
private var bannerOverlapping: Boolean = false
|
155
|
+
// private var bannerOverlapping: Boolean = false
|
157
156
|
|
158
157
|
override fun pluginInitialize() {
|
159
158
|
super.pluginInitialize()
|
@@ -1060,10 +1059,10 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
1060
1059
|
bannerView?.visibility = View.VISIBLE
|
1061
1060
|
bannerView?.resume()
|
1062
1061
|
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1062
|
+
if (isPosition == "top-center") {
|
1063
|
+
setBannerAdTop()
|
1064
|
+
} else {
|
1065
|
+
setBannerAdBottom()
|
1067
1066
|
}
|
1068
1067
|
|
1069
1068
|
bannerViewLayout?.requestFocus()
|
@@ -1217,33 +1216,7 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
1217
1216
|
|
1218
1217
|
}
|
1219
1218
|
return true
|
1220
|
-
|
1221
|
-
// Still under development
|
1222
|
-
} else if (action == "loadBannerAdNewApi") {
|
1223
|
-
if (mActivity != null) {
|
1224
|
-
val options = args.getJSONObject(0)
|
1225
|
-
mActivity?.runOnUiThread {
|
1226
|
-
val adUnitId = options.optString("adUnitId")
|
1227
|
-
val position = options.optString("position")
|
1228
|
-
val collapsible = options.optString("collapsible")
|
1229
|
-
val size = options.optString("size")
|
1230
|
-
val autoShow = options.optBoolean("autoShow")
|
1231
|
-
val overlapping = options.optBoolean("overlapping")
|
1232
|
-
this.bannerAdUnitId = adUnitId
|
1233
|
-
this.isPosition = position
|
1234
|
-
this.isSize = size
|
1235
|
-
this.bannerAutoShow = autoShow
|
1236
|
-
this.loadBannerAdNew = true
|
1237
|
-
this.collapsiblePos = collapsible
|
1238
|
-
this.bannerOverlapping = overlapping
|
1239
|
-
try {
|
1240
|
-
loadBannerAd(adUnitId, position, size)
|
1241
|
-
} catch (e: Exception) {
|
1242
|
-
callbackContext.error("loadBannerAdNewApi Error: " + e.message)
|
1243
|
-
}
|
1244
|
-
}
|
1245
|
-
}
|
1246
|
-
return true
|
1219
|
+
|
1247
1220
|
}
|
1248
1221
|
return false
|
1249
1222
|
}
|
@@ -1384,12 +1357,10 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
1384
1357
|
isBannerLoad = true
|
1385
1358
|
} else {
|
1386
1359
|
val errorMessage = "Error showing banner: bannerView or bannerViewLayout is null."
|
1387
|
-
// Log.e("isBannerAutoShow", errorMessage)
|
1388
1360
|
PUBLIC_CALLBACKS?.error(errorMessage)
|
1389
1361
|
}
|
1390
1362
|
} catch (e: Exception) {
|
1391
1363
|
val errorMessage = "Error showing banner: " + e.message
|
1392
|
-
// Log.e("isBannerAutoShow", errorMessage, e)
|
1393
1364
|
PUBLIC_CALLBACKS?.error(errorMessage)
|
1394
1365
|
}
|
1395
1366
|
}
|
@@ -1447,15 +1418,15 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
1447
1418
|
|
1448
1419
|
cWebView?.loadUrl("javascript:cordova.fireDocumentEvent('on.banner.failed.load', ${errorData});")
|
1449
1420
|
|
1450
|
-
bannerOverlappingToZero()
|
1451
|
-
|
1452
1421
|
if (bannerViewLayout != null && bannerView != null) {
|
1422
|
+
/*
|
1453
1423
|
bannerViewLayout?.removeView(bannerView)
|
1454
1424
|
bannerView?.destroy()
|
1455
1425
|
bannerView = null
|
1456
1426
|
bannerViewLayout = null
|
1427
|
+
*/
|
1457
1428
|
isBannerLoad = false
|
1458
|
-
isBannerShow = false
|
1429
|
+
//isBannerShow = false
|
1459
1430
|
isBannerPause = 2
|
1460
1431
|
lock = true
|
1461
1432
|
}
|
@@ -1478,13 +1449,20 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
1478
1449
|
isBannerLoad = true
|
1479
1450
|
isBannerPause = 0
|
1480
1451
|
|
1481
|
-
|
1482
|
-
|
1452
|
+
bannerView?.post {
|
1453
|
+
val heightInPx = bannerView?.height
|
1454
|
+
bannerViewHeight = heightInPx ?: 0
|
1483
1455
|
}
|
1484
1456
|
|
1457
|
+
if (isPosition == "top-center") {
|
1458
|
+
setBannerAdTop()
|
1459
|
+
} else {
|
1460
|
+
setBannerAdBottom()
|
1461
|
+
}
|
1485
1462
|
|
1486
|
-
|
1487
|
-
|
1463
|
+
if (bannerAutoShow) {
|
1464
|
+
isBannerAutoShow()
|
1465
|
+
}
|
1488
1466
|
|
1489
1467
|
val context = cordova.activity.applicationContext
|
1490
1468
|
var currentAdSize = when (adType) {
|
@@ -1493,17 +1471,11 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
1493
1471
|
"medium_rectangle" -> AdSize.MEDIUM_RECTANGLE
|
1494
1472
|
"full_banner" -> AdSize.FULL_BANNER
|
1495
1473
|
"leaderboard" -> AdSize.LEADERBOARD
|
1496
|
-
else -> adSize
|
1474
|
+
else -> adSize
|
1497
1475
|
}
|
1498
1476
|
|
1499
|
-
// Calculate the height in dp
|
1500
1477
|
val bannerHeightDp = getAdHeightInDp(currentAdSize, context)
|
1501
1478
|
|
1502
|
-
if(loadBannerAdNew) {
|
1503
|
-
setBannerAdNewApi(currentAdSize)
|
1504
|
-
}
|
1505
|
-
|
1506
|
-
|
1507
1479
|
val bannerLoadEventData = String.format(Locale.US, "{\"height\": %d}", bannerHeightDp)
|
1508
1480
|
|
1509
1481
|
|
@@ -1572,16 +1544,11 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
1572
1544
|
|
1573
1545
|
|
1574
1546
|
|
1575
|
-
private fun
|
1547
|
+
private fun setBannerAdBottom() {
|
1576
1548
|
if (bannerView != null && mActivity != null && cWebView != null) {
|
1577
1549
|
mActivity?.runOnUiThread {
|
1578
1550
|
bannerView?.post {
|
1579
1551
|
try {
|
1580
|
-
val measuredBannerHeight = if (bannerView!!.height > 0)
|
1581
|
-
bannerView!!.height
|
1582
|
-
else
|
1583
|
-
adSize.getHeightInPixels(mActivity!!)
|
1584
|
-
|
1585
1552
|
val screenHeightInPx = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
1586
1553
|
val windowMetrics = mActivity!!.windowManager.currentWindowMetrics
|
1587
1554
|
val insets = windowMetrics.windowInsets.getInsets(WindowInsets.Type.systemBars())
|
@@ -1594,7 +1561,7 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
1594
1561
|
displayMetrics.heightPixels
|
1595
1562
|
}
|
1596
1563
|
|
1597
|
-
val webViewHeight = screenHeightInPx -
|
1564
|
+
val webViewHeight = screenHeightInPx - bannerViewHeight
|
1598
1565
|
|
1599
1566
|
if (!isFullScreen) {
|
1600
1567
|
val navBarHeight = getNavigationBarHeight(mActivity!!)
|
@@ -1611,11 +1578,9 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
1611
1578
|
}
|
1612
1579
|
|
1613
1580
|
if (!isOverlapping) {
|
1614
|
-
|
1615
1581
|
val layoutParams = cWebView!!.view.layoutParams
|
1616
1582
|
layoutParams.height = webViewHeight
|
1617
1583
|
cWebView!!.view.layoutParams = layoutParams
|
1618
|
-
|
1619
1584
|
}
|
1620
1585
|
|
1621
1586
|
} catch (e: Exception) {
|
@@ -1627,6 +1592,53 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
1627
1592
|
}
|
1628
1593
|
|
1629
1594
|
|
1595
|
+
private fun setBannerAdTop() {
|
1596
|
+
mActivity?.let { activity ->
|
1597
|
+
bannerView?.post {
|
1598
|
+
val bannerHeightPx = bannerViewHeight
|
1599
|
+
val statusBarHeight = getStatusBarHeight(activity)
|
1600
|
+
if (isPosition.equals("top-center", ignoreCase = true)) {
|
1601
|
+
val bannerLp = bannerView?.layoutParams as? FrameLayout.LayoutParams
|
1602
|
+
bannerLp?.let { lp ->
|
1603
|
+
if (isOverlapping) {
|
1604
|
+
if (isFullScreen) {
|
1605
|
+
lp.topMargin = 0
|
1606
|
+
bannerView?.layoutParams = lp
|
1607
|
+
} else {
|
1608
|
+
lp.topMargin = statusBarHeight
|
1609
|
+
bannerView?.layoutParams = lp
|
1610
|
+
}
|
1611
|
+
} else {
|
1612
|
+
if (isFullScreen) {
|
1613
|
+
lp.topMargin = 0
|
1614
|
+
bannerView?.layoutParams = lp
|
1615
|
+
} else {
|
1616
|
+
lp.topMargin = statusBarHeight
|
1617
|
+
bannerView?.layoutParams = lp
|
1618
|
+
}
|
1619
|
+
}
|
1620
|
+
|
1621
|
+
}
|
1622
|
+
}
|
1623
|
+
|
1624
|
+
cWebView?.let { webView ->
|
1625
|
+
val webLp = webView.view.layoutParams as FrameLayout.LayoutParams
|
1626
|
+
if (isPosition.equals("top-center", ignoreCase = true)) {
|
1627
|
+
|
1628
|
+
if (isOverlapping) {
|
1629
|
+
webLp.topMargin = 0
|
1630
|
+
} else {
|
1631
|
+
webLp.topMargin = bannerHeightPx
|
1632
|
+
}
|
1633
|
+
}
|
1634
|
+
webView.view.layoutParams = webLp
|
1635
|
+
webView.view.requestLayout()
|
1636
|
+
}
|
1637
|
+
}}
|
1638
|
+
}
|
1639
|
+
|
1640
|
+
|
1641
|
+
|
1630
1642
|
|
1631
1643
|
|
1632
1644
|
private val bannerPaidAdListener = OnPaidEventListener { adValue ->
|
@@ -1769,7 +1781,6 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
1769
1781
|
this.isUsingAdManagerRequest = isUsingAdManagerRequest
|
1770
1782
|
}
|
1771
1783
|
|
1772
|
-
|
1773
1784
|
private fun targetingAdRequest(customTargeting: JSONArray?, categoryExclusions: String, ppId: String, ctURL: String, brandSafetyArr: JSONArray?) {
|
1774
1785
|
try {
|
1775
1786
|
customTargetingList = ArrayList()
|
@@ -1889,7 +1900,6 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
1889
1900
|
|
1890
1901
|
if (this.customTargetingEnabled) {
|
1891
1902
|
if (customTargetingList!!.isEmpty()) {
|
1892
|
-
// Log.d(TAG, "List is empty")
|
1893
1903
|
PUBLIC_CALLBACKS?.error("List is empty")
|
1894
1904
|
} else {
|
1895
1905
|
builder.addCustomTargeting("age", customTargetingList!!)
|
@@ -1918,7 +1928,6 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
1918
1928
|
|
1919
1929
|
if (this.brandSafetyEnabled) {
|
1920
1930
|
if (brandSafetyUrls!!.isEmpty()) {
|
1921
|
-
//Log.d(TAG, "List is empty")
|
1922
1931
|
PUBLIC_CALLBACKS?.error("List is empty")
|
1923
1932
|
} else {
|
1924
1933
|
builder.setNeighboringContentUrls(brandSafetyUrls!!)
|
@@ -2003,6 +2012,7 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
2003
2012
|
return sb.toString().uppercase(Locale.getDefault())
|
2004
2013
|
} catch (e: NoSuchAlgorithmException) {
|
2005
2014
|
algorithm = "SHA-1"
|
2015
|
+
PUBLIC_CALLBACKS?.error(e.message)
|
2006
2016
|
try {
|
2007
2017
|
val messageDigest = MessageDigest.getInstance(algorithm)
|
2008
2018
|
val contentResolver = mContext!!.contentResolver
|
@@ -2237,26 +2247,6 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
2237
2247
|
}
|
2238
2248
|
|
2239
2249
|
|
2240
|
-
|
2241
|
-
// Still under development
|
2242
|
-
// START loadBannerAdNewApi
|
2243
|
-
|
2244
|
-
|
2245
|
-
private fun setBannerAdNewApi(currentAdSize: AdSize) {
|
2246
|
-
|
2247
|
-
if (loadBannerAdNew && isPosition.equals("top-center", ignoreCase = true)) {
|
2248
|
-
|
2249
|
-
setBannerAdNewApiTop() // loadBannerAdNewApi
|
2250
|
-
|
2251
|
-
} else if (loadBannerAdNew && isPosition.equals("bottom-center", ignoreCase = true)) {
|
2252
|
-
|
2253
|
-
setBannerAdNewApiBottom(currentAdSize) // loadBannerAdNewApi
|
2254
|
-
|
2255
|
-
}
|
2256
|
-
}
|
2257
|
-
|
2258
|
-
|
2259
|
-
|
2260
2250
|
private fun isFullScreenMode(activity: Activity): Boolean {
|
2261
2251
|
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
2262
2252
|
activity.window.decorView.rootWindowInsets?.isVisible(WindowInsets.Type.statusBars()) == false
|
@@ -2266,8 +2256,6 @@ private fun setBannerAdNewApi(currentAdSize: AdSize) {
|
|
2266
2256
|
}
|
2267
2257
|
}
|
2268
2258
|
|
2269
|
-
|
2270
|
-
|
2271
2259
|
@SuppressLint("DiscouragedApi", "InternalInsetResource")
|
2272
2260
|
private fun getNavigationBarHeight(context: Context): Int {
|
2273
2261
|
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
@@ -2286,153 +2274,7 @@ private fun setBannerAdNewApi(currentAdSize: AdSize) {
|
|
2286
2274
|
|
2287
2275
|
|
2288
2276
|
|
2289
|
-
|
2290
|
-
mActivity?.let { activity ->
|
2291
|
-
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
2292
|
-
val windowMetrics = activity.windowManager.currentWindowMetrics
|
2293
|
-
val insets = windowMetrics.windowInsets
|
2294
|
-
.getInsetsIgnoringVisibility(WindowInsets.Type.navigationBars())
|
2295
|
-
val screenHeight = windowMetrics.bounds.height()
|
2296
|
-
|
2297
|
-
val usableHeight = screenHeight - insets.bottom
|
2298
|
-
Pair(screenHeight, usableHeight)
|
2299
|
-
} else {
|
2300
|
-
@Suppress("DEPRECATION")
|
2301
|
-
val display = activity.windowManager.defaultDisplay
|
2302
|
-
val size = Point()
|
2303
|
-
val realSize = Point()
|
2304
|
-
@Suppress("DEPRECATION")
|
2305
|
-
display.getSize(size)
|
2306
|
-
@Suppress("DEPRECATION")
|
2307
|
-
display.getRealSize(realSize)
|
2308
|
-
|
2309
|
-
Pair(realSize.y, size.y)
|
2310
|
-
}
|
2311
|
-
} ?: throw IllegalStateException("Activity is null")
|
2312
|
-
}
|
2313
|
-
|
2314
|
-
|
2315
|
-
private fun setBannerAdNewApiBottom(adSize: AdSize) {
|
2316
|
-
|
2317
|
-
mActivity?.let { activity ->
|
2318
|
-
|
2319
|
-
val bannerHeightPx = adSize.getHeightInPixels(activity)
|
2320
|
-
|
2321
|
-
val (screenHeight, usableHeight) = getScreenMetrics()
|
2322
|
-
|
2323
|
-
val navBarHeight = if (!isFullScreen) getNavigationBarHeight(activity) else 0
|
2324
|
-
|
2325
|
-
val adjustment = (bannerHeightPx * 0.3).toInt()
|
2326
|
-
|
2327
|
-
val newWebViewHeight = if (isFullScreen) {
|
2328
|
-
if (bannerOverlapping) {
|
2329
|
-
screenHeight - 0
|
2330
|
-
} else {
|
2331
|
-
screenHeight - bannerHeightPx
|
2332
|
-
}
|
2333
|
-
} else {
|
2334
|
-
if (bannerOverlapping) {
|
2335
|
-
usableHeight - 0 //navBarHeight - bannerHeightPx
|
2336
|
-
} else {
|
2337
|
-
usableHeight - navBarHeight - bannerHeightPx + adjustment
|
2338
|
-
}
|
2339
|
-
}
|
2340
|
-
|
2341
|
-
if (!bannerOverlapping) {
|
2342
|
-
cWebView?.let { webView ->
|
2343
|
-
val layoutParams = webView.view.layoutParams
|
2344
|
-
layoutParams.height = newWebViewHeight.coerceAtLeast(0)
|
2345
|
-
webView.view.layoutParams = layoutParams
|
2346
|
-
webView.view.requestLayout()
|
2347
|
-
}
|
2348
|
-
}
|
2349
|
-
|
2350
|
-
|
2351
|
-
|
2352
|
-
if (!isFullScreen) {
|
2353
|
-
bannerViewLayout?.let { container ->
|
2354
|
-
container.post {
|
2355
|
-
val params = container.layoutParams
|
2356
|
-
if (params is ViewGroup.MarginLayoutParams) {
|
2357
|
-
params.bottomMargin = if (!isFullScreen) navBarHeight else 0
|
2358
|
-
container.layoutParams = params
|
2359
|
-
container.requestLayout()
|
2360
|
-
}
|
2361
|
-
}
|
2362
|
-
}
|
2363
|
-
}
|
2364
|
-
|
2365
|
-
|
2366
|
-
}
|
2367
|
-
}
|
2368
|
-
|
2369
|
-
|
2370
|
-
|
2371
|
-
|
2372
|
-
|
2373
|
-
|
2374
|
-
private fun setBannerAdNewApiTop() {
|
2375
|
-
mActivity?.let { activity ->
|
2376
|
-
bannerView?.post {
|
2377
|
-
val bannerHeightPx = bannerView?.height ?: 0
|
2378
|
-
val statusBarHeight = getStatusBarHeight(activity)
|
2379
|
-
|
2380
|
-
if (isPosition.equals("top-center", ignoreCase = true)) {
|
2381
|
-
val bannerLp = bannerView?.layoutParams as? FrameLayout.LayoutParams
|
2382
|
-
bannerLp?.let { lp ->
|
2383
|
-
if (bannerOverlapping) {
|
2384
|
-
if (isFullScreen) {
|
2385
|
-
lp.topMargin = 0
|
2386
|
-
bannerView?.layoutParams = lp
|
2387
|
-
} else {
|
2388
|
-
lp.topMargin = 0 // bannerHeightPx // + statusBarHeight
|
2389
|
-
bannerView?.layoutParams = lp
|
2390
|
-
}
|
2391
|
-
} else {
|
2392
|
-
if (isFullScreen) {
|
2393
|
-
lp.topMargin = 0
|
2394
|
-
bannerView?.layoutParams = lp
|
2395
|
-
} else {
|
2396
|
-
lp.topMargin = statusBarHeight
|
2397
|
-
bannerView?.layoutParams = lp
|
2398
|
-
}
|
2399
|
-
}
|
2400
|
-
|
2401
|
-
}
|
2402
|
-
}
|
2403
|
-
|
2404
|
-
cWebView?.let { webView ->
|
2405
|
-
val webLp = webView.view.layoutParams as FrameLayout.LayoutParams
|
2406
|
-
if (isPosition.equals("top-center", ignoreCase = true)) {
|
2407
|
-
|
2408
|
-
if (bannerOverlapping) {
|
2409
|
-
if (isFullScreen) {
|
2410
|
-
webLp.topMargin = 0 //+ statusBarHeight
|
2411
|
-
} else {
|
2412
|
-
webLp.topMargin = 0 //bannerHeightPx // + statusBarHeight
|
2413
|
-
}
|
2414
|
-
} else {
|
2415
|
-
if (isFullScreen) {
|
2416
|
-
webLp.topMargin = bannerHeightPx
|
2417
|
-
} else {
|
2418
|
-
webLp.topMargin = bannerHeightPx
|
2419
|
-
}
|
2420
|
-
}
|
2421
|
-
|
2422
|
-
|
2423
|
-
}
|
2424
|
-
|
2425
|
-
webView.view.layoutParams = webLp
|
2426
|
-
webView.view.requestLayout()
|
2427
|
-
}
|
2428
|
-
}}
|
2429
|
-
}
|
2430
|
-
|
2431
|
-
|
2432
|
-
|
2433
|
-
|
2434
|
-
|
2435
|
-
@SuppressLint("InternalInsetResource")
|
2277
|
+
@SuppressLint("InternalInsetResource", "DiscouragedApi")
|
2436
2278
|
private fun getStatusBarHeight(context: Context): Int {
|
2437
2279
|
var result = 0
|
2438
2280
|
val resourceId = context.resources.getIdentifier("status_bar_height", "dimen", "android")
|
@@ -2443,8 +2285,6 @@ private fun setBannerAdNewApi(currentAdSize: AdSize) {
|
|
2443
2285
|
}
|
2444
2286
|
|
2445
2287
|
|
2446
|
-
// END loadBannerAdNewApi
|
2447
|
-
|
2448
2288
|
|
2449
2289
|
private val view: View?
|
2450
2290
|
get() {
|
@@ -2488,7 +2328,7 @@ private fun setBannerAdNewApi(currentAdSize: AdSize) {
|
|
2488
2328
|
|
2489
2329
|
|
2490
2330
|
companion object {
|
2491
|
-
|
2331
|
+
// private const val TAG = "emiAdmobPlugin"
|
2492
2332
|
|
2493
2333
|
// Consent status will automatically reset after 12 months
|
2494
2334
|
// https://support.google.com/admanager/answer/9999955?hl=en
|
package/www/emiAdmobPlugin.js
CHANGED
@@ -16,14 +16,11 @@ exports.showAppOpenAd = function (success, error) {
|
|
16
16
|
exec(success, error, 'emiAdmobPlugin', 'showAppOpenAd', []);
|
17
17
|
};
|
18
18
|
exports.styleBannerAd = function (options, success, error) {
|
19
|
-
exec(success, error, 'emiAdmobPlugin', 'styleBannerAd', [options]);
|
19
|
+
exec(success, error, 'emiAdmobPlugin', 'styleBannerAd', [options]);
|
20
20
|
};
|
21
21
|
exports.loadBannerAd = function (options, success, error) {
|
22
22
|
exec(success, error, 'emiAdmobPlugin', 'loadBannerAd', [options]);
|
23
23
|
};
|
24
|
-
exports.loadBannerAdNewApi = function (options, success, error) {
|
25
|
-
exec(success, error, 'emiAdmobPlugin', 'loadBannerAdNewApi', [options]);
|
26
|
-
};
|
27
24
|
exports.showBannerAd = function (success, error) {
|
28
25
|
exec(success, error, 'emiAdmobPlugin', 'showBannerAd', []);
|
29
26
|
};
|
package/.gitattributes
DELETED
package/.github/FUNDING.yml
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# These are supported funding model platforms
|
2
|
-
|
3
|
-
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
4
|
-
patreon: # Replace with a single Patreon username
|
5
|
-
open_collective: # Replace with a single Open Collective username
|
6
|
-
ko_fi: emiindo
|
7
|
-
tidelift: # npm/emi-indo-cordova-plugin-admob
|
8
|
-
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
9
|
-
liberapay: # Replace with a single Liberapay username
|
10
|
-
issuehunt: # Replace with a single IssueHunt username
|
11
|
-
otechie: # Replace with a single Otechie username
|
12
|
-
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
13
|
-
custom: ['paypal.me/emiindo']
|
@@ -1,127 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: Bug report
|
3
|
-
about: Create a report to help us improve
|
4
|
-
title: ''
|
5
|
-
labels: ''
|
6
|
-
assignees: ''
|
7
|
-
|
8
|
-
---
|
9
|
-
|
10
|
-
<!--
|
11
|
-
IMPORTANT: PLEASE READ
|
12
|
-
|
13
|
-
WARNING: Failure to follow the issue template guidelines below will result in the issue being immediately closed.
|
14
|
-
-->
|
15
|
-
|
16
|
-
<!-- Fill out the relevant sections below and delete irrelevant sections. -->
|
17
|
-
|
18
|
-
# Bug report
|
19
|
-
|
20
|
-
<!-- COMPLETE THIS CHECKLIST -->
|
21
|
-
|
22
|
-
|
23
|
-
- [ ] I confirm this is a suspected bug or issue that will affect other users
|
24
|
-
<!-- i.e. this is not a request for support in using/integrating the plugin into your specific project -->
|
25
|
-
|
26
|
-
- [ ] I have reproduced the issue using the [example project](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/blob/main/example/index.html) or provided the necessary information to reproduce the issue.
|
27
|
-
<!-- necessary information e.g. exact steps, FCM notification message content, test case project repo -->
|
28
|
-
|
29
|
-
- [ ] I have read [the documentation](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/blob/main/README.md) thoroughly and it does not help solve my issue.
|
30
|
-
<!-- e.g. if you're having a build issue ensure you've read through the build environment notes -->
|
31
|
-
|
32
|
-
- [ ] I have checked that no similar issues (open or closed) already exist.
|
33
|
-
<!-- Duplicates or near-duplicates will be closed immediately. -->
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
**Current behavior:**
|
38
|
-
|
39
|
-
<!-- Describe how the bug manifests. -->
|
40
|
-
|
41
|
-
<!-- Explain how you're sure there is an issue with this plugin rather than your own code:
|
42
|
-
- If this plugin has an example project, have you been able to reproduce the issue within it?
|
43
|
-
- Have you created a clean test Cordova project containing only this plugin to eliminate the potential for interference with other plugins/code?
|
44
|
-
-->
|
45
|
-
|
46
|
-
**Expected behavior:**
|
47
|
-
<!-- Describe what the behavior should be without the bug. -->
|
48
|
-
|
49
|
-
**Steps to reproduce:**
|
50
|
-
<!-- If you are able to illustrate the bug with an example, please provide steps to reproduce. -->
|
51
|
-
|
52
|
-
**Screenshots**
|
53
|
-
<!-- If applicable, add screenshots to help explain your problem. -->
|
54
|
-
|
55
|
-
**Environment information**
|
56
|
-
<!-- Please supply full details of your development environment including: -->
|
57
|
-
- Plugin version
|
58
|
-
- `Plugin version: xxxx`
|
59
|
-
|
60
|
-
- Cordova CLI version
|
61
|
-
- `cordova -v`
|
62
|
-
- Cordova platform version
|
63
|
-
- `cordova platform ls`
|
64
|
-
- Plugins & versions installed in project (including this plugin)
|
65
|
-
- `cordova plugin ls`
|
66
|
-
- Dev machine OS and version, e.g.
|
67
|
-
- OSX
|
68
|
-
- `sw_vers`
|
69
|
-
- Windows 10
|
70
|
-
- `winver`
|
71
|
-
|
72
|
-
_Runtime issue_
|
73
|
-
- Device details
|
74
|
-
- _e.g. iPhone X, Samsung Galaxy S8, iPhone X Simulator, Pixel XL Emulator_
|
75
|
-
- OS details
|
76
|
-
- _e.g. iOS 12.2, Android 9.0_
|
77
|
-
|
78
|
-
_Android build issue:_
|
79
|
-
- Node JS version
|
80
|
-
- `node -v`
|
81
|
-
- Gradle version
|
82
|
-
- `ls platforms/android/.gradle`
|
83
|
-
- Target Android SDK version
|
84
|
-
- `android:targetSdkVersion` in `AndroidManifest.xml`
|
85
|
-
- Android SDK details
|
86
|
-
- `sdkmanager --list | sed -e '/Available Packages/q'`
|
87
|
-
|
88
|
-
_iOS build issue:_
|
89
|
-
- Node JS version
|
90
|
-
- `node -v`
|
91
|
-
- XCode version
|
92
|
-
|
93
|
-
|
94
|
-
**Related code:**
|
95
|
-
```
|
96
|
-
insert any relevant code here such as plugin API calls / input parameters
|
97
|
-
```
|
98
|
-
|
99
|
-
**Console output**
|
100
|
-
<details>
|
101
|
-
<summary>console output</summary>
|
102
|
-
|
103
|
-
```
|
104
|
-
|
105
|
-
// Paste any relevant JS/native console output here
|
106
|
-
|
107
|
-
```
|
108
|
-
|
109
|
-
</details><br/><br/>
|
110
|
-
|
111
|
-
**Other information:**
|
112
|
-
|
113
|
-
<!-- List any other information that is relevant to your issue. Stack traces, related issues, suggestions on how to fix, Stack Overflow links, forum links, etc. -->
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
<!--
|
120
|
-
A POLITE REMINDER
|
121
|
-
|
122
|
-
- This is free, open-source software.
|
123
|
-
- Although the author makes every effort to maintain it, no guarantees are made as to the quality or reliability, and reported issues will be addressed if and when the author has time.
|
124
|
-
- Help/support will not be given by the author, so forums (e.g. Ionic) or Stack Overflow should be used. Any issues requesting help/support will be closed immediately.
|
125
|
-
- If you have urgent need of a bug fix/feature, the author can be engaged for PAID contract work to do so: please contact dave@workingedge.co.uk
|
126
|
-
- Rude or abusive comments/issues will not be tolerated, nor will opening multiple issues if those previously closed are deemed unsuitable. Any of the above will result in you being BANNED from ALL of my Github repositories.
|
127
|
-
-->
|