Commit f576c13a authored by maxiaoliang's avatar maxiaoliang

修改上报

parent ed74f56a
......@@ -14,7 +14,7 @@ import com.google.firebase.ktx.Firebase
import org.json.JSONObject
object AdMaxEvent {
fun pullAd(ad:MaxAd,adUnit: String, error: String? = null, reqId: String? = null){
fun pullAd(ad: MaxAd?, adUnit: String, error: String? = null, reqId: String? = null) {
val obj = JSONObject()
obj.put("UnitId", ad?.adUnitId)
obj.put("ad_unit", adUnit)
......@@ -37,6 +37,7 @@ object AdMaxEvent {
}
EventUtils.event("ad_pull", ext = obj)
}
fun clickAd(ad: MaxAd?, adUnit: String) {
val obj = JSONObject()
......@@ -70,9 +71,11 @@ object AdMaxEvent {
EventUtils.event("ad_show", ext = obj)
}
private val taichiPref = FacebookSdk.getApplicationContext()
.getSharedPreferences("TaichiTroasCache", 0)
private val taichiSharedPreferencesEditor = taichiPref.edit()
class EventOnPaidEventListener : MaxAdRevenueListener {
override fun onAdRevenuePaid(ad: MaxAd) {
val params = Bundle()
......@@ -103,7 +106,8 @@ object AdMaxEvent {
}
val obj = JSONObject()
val revenue = ad.revenue
val countryCode = AppLovinSdk.getInstance(BaseApplication.context).configuration.countryCode
val countryCode =
AppLovinSdk.getInstance(BaseApplication.context).configuration.countryCode
val networkName = ad.networkName
val adUnitId = ad.adUnitId
val adFormat = ad.format
......
......@@ -13,6 +13,7 @@ import com.base.datarecovery.utils.EventUtils
import com.base.datarecovery.utils.LogEx
import com.base.datarecovery.view.CustomDialog
import org.json.JSONObject
import java.util.UUID
import java.util.concurrent.TimeUnit
import kotlin.math.min
import kotlin.math.pow
......@@ -31,6 +32,12 @@ object AdMaxInterstitialUtils {
private fun setListener(activity: Activity) {
if (interstitialAd == null) {
val reqId = UUID.randomUUID().toString()
val obj = JSONObject()
obj.put("req_id", reqId)
obj.put("ad_type", "interAd")
EventUtils.event("ad_pull_start", ext = obj)
interstitialAd = MaxInterstitialAd(ConfigHelper.interAdMaxId, activity)
interstitialAd?.setListener(object : MaxAdListener {
override fun onAdLoaded(p0: MaxAd) {
......@@ -38,10 +45,12 @@ object AdMaxInterstitialUtils {
loadingListener?.invoke()
interLoadTime = System.currentTimeMillis()
retryAttempt = 0
AdMaxEvent.pullAd(p0,"interAd",reqId = reqId)
}
override fun onAdLoadFailed(p0: String, p1: MaxError) {
LogEx.logDebug(TAG, "onAdLoadFailed")
AdMaxEvent.pullAd(null,"interAd",reqId = reqId)
AdDisplayUtils.getInstance().incrementAdRequestFailCount()
retryAttempt++
LogEx.logDebug(TAG, "onAdLoadFailed retryAttempt=$retryAttempt")
......@@ -107,6 +116,7 @@ object AdMaxInterstitialUtils {
}
this.onHidden = onHidden
interstitialAd?.setRevenueListener(AdMaxEvent.EventOnPaidEventListener())
if (interstitialAd?.isReady == true) {
LogEx.logDebug(TAG, "isReady=true")
interstitialAd?.showAd()
......
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