Commit d9e4b90f authored by jyx's avatar jyx

TopOn 激励视频对接

parent 17ae2018
......@@ -352,10 +352,21 @@ dependencies {
transitive = true
changing = true
}
//愉悦赚
implementation(name: 'mduisdk_v3.1.0.18_support_msa_1.0.23', ext: 'aar')
implementation 'com.tencent.tbs.tbssdk:sdk:43903'
// TopOn 聚合平台
implementation(name: 'anythink_china_core', ext: 'aar')
implementation(name: 'anythink_core', ext: 'aar')
implementation(name: 'anythink_interstitial', ext: 'aar')
implementation(name: 'anythink_native', ext: 'aar')
implementation(name: 'anythink_network_pangle_china', ext: 'aar')
implementation(name: 'anythink_rewardvideo', ext: 'aar')
implementation(name: 'anythink_splash', ext: 'aar')
implementation(name: 'tramini_sdk', ext: 'aar')
// //芒果联盟
// implementation 'com.openppeace.mgmob:mgmob:1.3.5-alpha6'//MGMob
......
......@@ -18,6 +18,7 @@ import com.mints.goodmoney.manager.MhManager;
import com.mints.goodmoney.manager.MiitHelper;
import com.mints.goodmoney.manager.ReaderManager;
import com.mints.goodmoney.manager.RsNewsManager;
import com.mints.goodmoney.manager.TopOnManager;
import com.mints.goodmoney.manager.TtCsjAdManager;
import com.mints.goodmoney.manager.TzManager;
import com.mints.goodmoney.manager.WnManager;
......@@ -114,7 +115,7 @@ public class MintsApplication extends MultiDexApplication {
private void thirdConfig() {
// 友盟SDK预初始化函数
// preInit预初始化函数耗时极少,不会影响App首次冷启动用户体验
UMConfigure.preInit(this,CommonUtils.getAppMetaData(MintsApplication.getContext(), "UMENG_KEY"), CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME"));
UMConfigure.preInit(this, CommonUtils.getAppMetaData(MintsApplication.getContext(), "UMENG_KEY"), CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME"));
// 初始化toast
initToast();
......@@ -152,6 +153,9 @@ public class MintsApplication extends MultiDexApplication {
// 瑞狮新闻
RsNewsManager.INSTANCE.init(this);
// TopOn
TopOnManager.INSTANCE.init(this);
// 喜马拉雅
initXmly();
......
package com.mints.goodmoney.ad.video
import android.app.Activity
import com.anythink.core.api.ATAdConst
import com.anythink.core.api.ATAdInfo
import com.anythink.core.api.AdError
import com.anythink.rewardvideo.api.ATRewardVideoAd
import com.anythink.rewardvideo.api.ATRewardVideoExListener
import com.mints.goodmoney.ad.video.base.BaseVideoAd
import com.mints.goodmoney.ad.video.base.VideoAdStatusListener
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TopOnManager
import com.mints.goodmoney.manager.TrackManager
import com.mints.goodmoney.utils.LogUtil
import java.util.*
private val TAG = TopOnVideoAdManager::class.java.simpleName
/**
* TopOn 广告视频
*/
class TopOnVideoAdManager : BaseVideoAd() {
private var videoAdStatusListener: VideoAdStatusListener? = null
private var isClickScreen: Boolean = true
companion object {
val INSTANCE: TopOnVideoAdManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
TopOnVideoAdManager()
}
}
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
isClickScreen = true
val rewardVideoAd = ATRewardVideoAd(activity, TopOnManager.TOPPN_REWARD_VIDEO_ID)
val userid = "test_userid_001"
val userdata = "test_userdata_001"
val localMap: MutableMap<String, Any> = HashMap()
localMap[ATAdConst.KEY.USER_ID] = userid
localMap[ATAdConst.KEY.USER_CUSTOM_DATA] = userdata
rewardVideoAd.setLocalExtra(localMap)
rewardVideoAd.setAdListener(object : ATRewardVideoExListener {
override fun onRewardedVideoAdClosed(p0: ATAdInfo?) {
TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_TOPON, extraId, curCoin))
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_TOPON, Constant.EVENT_TYPE_THREE, "", "")
videoAdStatusListener?.adSuccess()
}
override fun onReward(p0: ATAdInfo?) {
p0?.networkPlacementId
LogUtil.d(p0)
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_ZERO, "", "")
}
override fun onRewardedVideoAdPlayFailed(p0: AdError?, p1: ATAdInfo?) {
}
override fun onRewardedVideoAdLoaded() {
rewardVideoAd.show(activity)
}
override fun onRewardedVideoAdPlayStart(p0: ATAdInfo?) {
}
override fun onRewardedVideoAdFailed(p0: AdError?) {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_ONE, p0?.code, p0?.desc)
videoAdStatusListener?.adFail()
}
override fun onDeeplinkCallback(p0: ATAdInfo?, p1: Boolean) {
}
override fun onRewardedVideoAdPlayEnd(p0: ATAdInfo?) {
}
override fun onRewardedVideoAdPlayClicked(p0: ATAdInfo?) {
if (AppConfig.needReportClickAdEvent) {
TrackManager.getInstance().reportClickAdEvent()
}
LogUtil.d(TAG, "onADClick")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_TOPON, Constant.EVENT_TYPE_TWO, "", "")
if (isClickScreen) {
// 防止重复
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_TOPON, Constant.EVENT_TYPE_FOUR, "", "")
isClickScreen = false
}
videoAdStatusListener?.adDownload()
}
})
rewardVideoAd.load()
}
fun setVideoAdStatusListener(videoAdStatusListener: VideoAdStatusListener?) {
this.videoAdStatusListener = videoAdStatusListener
}
}
\ No newline at end of file
......@@ -155,6 +155,7 @@ object Constant {
const val AD_SOURCE_SH = "CORAL" //珊瑚天卓
const val AD_SOURCE_KS = "KS" //快手
const val AD_SOURCE_RTA = "RTA" //RTA
const val AD_SOURCE_TOPON = "TOPON" //RTA
// 调用事件 0 成功 1失败 2点击 3-有效展示 4-去重
const val EVENT_TYPE_ZERO = "0"
......
package com.mints.goodmoney.manager
import android.app.Application
import com.anythink.core.api.ATSDK
import com.mints.goodmoney.BuildConfig
/**
* 描述:TopOn聚合平台
*/
object TopOnManager {
private const val TOPPN_APP_ID = "a5aa1f9deda26d"
private const val TOPPN_APP_KEY = "4f7b9ac17decb9babec83aac078742c7"
const val TOPPN_REWARD_VIDEO_ID = "b5b449fb3d89d7"
/**
*
* TopOn init
*/
fun init(application: Application) {
if (BuildConfig.DEBUG) {
ATSDK.setNetworkLogDebug(true)
}
ATSDK.init(application, TOPPN_APP_ID, TOPPN_APP_KEY)
}
}
\ No newline at end of file
......@@ -3,22 +3,17 @@ package com.mints.goodmoney.ui.activitys
import android.annotation.SuppressLint
import android.os.Bundle
import android.view.View
import android.widget.FrameLayout
import android.widget.ImageView
import com.bytedance.hume.readapk.HumeSDK
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.banner.BannerManager
import com.mints.goodmoney.ad.video.TopOnVideoAdManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TtCsjAdManager
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.adapter.AdBannerAdapter
import com.mints.goodmoney.utils.ToastUtil
import com.mints.library.utils.CommonUtils
import com.mints.library.utils.ConstantUtil
import kotlinx.android.synthetic.main.activity_aboutus.*
import kotlinx.android.synthetic.main.fragment_main_my.*
import kotlinx.android.synthetic.main.header_layout.*
/**
......@@ -54,10 +49,12 @@ class AboutusActivity : BaseActivity(), View.OnClickListener {
when (v?.id) {
R.id.iv_left_icon -> finish()
R.id.tvAboutasService -> {
val bundle = Bundle()
bundle.putString(WebActivity.WEB_TITLE, getString(R.string.register_name))
bundle.putString(WebActivity.WEB_URL, Constant.REGISTER_URL)
readyGo(WebActivity::class.java, bundle)
// val bundle = Bundle()
// bundle.putString(WebActivity.WEB_TITLE, getString(R.string.register_name))
// bundle.putString(WebActivity.WEB_URL, Constant.REGISTER_URL)
// readyGo(WebActivity::class.java, bundle)
TopOnVideoAdManager.INSTANCE.loadAd(this, 0, "", "")
}
R.id.tvAboutasPolicy -> {
val bundle = Bundle()
......
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