Commit 21ab7e3f authored by wanglei's avatar wanglei

插页拉不到广告情况

parent 4cf62136
......@@ -36,6 +36,7 @@ object AdMaxInterstitialUtils {
private var onHidden: (() -> Unit)? = null
private var loadingListener: (() -> Unit)? = null
private var retryAttempt = 0
private var maxRetryAttempt = 8
@SuppressLint("StaticFieldLeak")
private var customDialog: CustomDialog? = null
......@@ -58,11 +59,19 @@ object AdMaxInterstitialUtils {
AdDisplayUtils.getInstance().incrementAdRequestFailCount()
retryAttempt++
val delayMillis = TimeUnit.SECONDS.toMillis(2.0.pow(min(6, retryAttempt)).toLong())
LogEx.logDebug(TAG, "onAdLoadFailed retryAttempt=$retryAttempt delayMillis=$delayMillis")
if (retryAttempt == 2) {
onHidden?.invoke()
}
if (retryAttempt <= maxRetryAttempt) {
MainScope().launch {
delay(delayMillis)
interstitialAd?.loadAd()
}
} else {
retryAttempt = 0
}
}
override fun onAdDisplayed(p0: MaxAd) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment