Commit 27164712 authored by jyx's avatar jyx

添加OneWay激励视频

parent 96064363
...@@ -355,6 +355,8 @@ dependencies { ...@@ -355,6 +355,8 @@ dependencies {
//愉悦赚 //愉悦赚
implementation(name: 'mduisdk_v3.1.0.18_support_msa_1.0.23', ext: 'aar') implementation(name: 'mduisdk_v3.1.0.18_support_msa_1.0.23', ext: 'aar')
implementation 'com.tencent.tbs.tbssdk:sdk:43903' implementation 'com.tencent.tbs.tbssdk:sdk:43903'
// OneWay
implementation(name: 'oneway-common-core-1.0.10', ext: 'aar')
// //芒果联盟 // //芒果联盟
// implementation 'com.openppeace.mgmob:mgmob:1.3.5-alpha6'//MGMob // implementation 'com.openppeace.mgmob:mgmob:1.3.5-alpha6'//MGMob
......
...@@ -16,6 +16,7 @@ import com.mints.goodmoney.manager.KsManager; ...@@ -16,6 +16,7 @@ import com.mints.goodmoney.manager.KsManager;
import com.mints.goodmoney.manager.LiebaoManager; import com.mints.goodmoney.manager.LiebaoManager;
import com.mints.goodmoney.manager.MhManager; import com.mints.goodmoney.manager.MhManager;
import com.mints.goodmoney.manager.MiitHelper; import com.mints.goodmoney.manager.MiitHelper;
import com.mints.goodmoney.manager.OwManager;
import com.mints.goodmoney.manager.ReaderManager; import com.mints.goodmoney.manager.ReaderManager;
import com.mints.goodmoney.manager.RsNewsManager; import com.mints.goodmoney.manager.RsNewsManager;
import com.mints.goodmoney.manager.TtCsjAdManager; import com.mints.goodmoney.manager.TtCsjAdManager;
...@@ -114,7 +115,7 @@ public class MintsApplication extends MultiDexApplication { ...@@ -114,7 +115,7 @@ public class MintsApplication extends MultiDexApplication {
private void thirdConfig() { private void thirdConfig() {
// 友盟SDK预初始化函数 // 友盟SDK预初始化函数
// preInit预初始化函数耗时极少,不会影响App首次冷启动用户体验 // 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 // 初始化toast
initToast(); initToast();
...@@ -137,6 +138,9 @@ public class MintsApplication extends MultiDexApplication { ...@@ -137,6 +138,9 @@ public class MintsApplication extends MultiDexApplication {
// 枫岚广告 // 枫岚广告
MhManager.INSTANCE.initMn(this); MhManager.INSTANCE.initMn(this);
// OneWay
OwManager.INSTANCE.init(this);
// 天卓珊瑚[INSTANCE是设置单例模式] // 天卓珊瑚[INSTANCE是设置单例模式]
TzManager.INSTANCE.initTz(this); TzManager.INSTANCE.initTz(this);
......
package com.mints.goodmoney.ad.video
import android.app.Activity
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.OwManager
import com.mints.goodmoney.manager.TrackManager
import mobi.oneway.export.Ad.OWRewardedAd
import mobi.oneway.export.AdListener.OWRewardedAdListener
import mobi.oneway.export.enums.OnewayAdCloseType
import mobi.oneway.export.enums.OnewaySdkError
private val TAG = OwVideoAdManager::class.java.simpleName
/**
* OneWay广告视频
*/
class OwVideoAdManager private constructor() :
BaseVideoAd() {
private var videoAdStatusListener: VideoAdStatusListener? = null
private var owRewardedAd: OWRewardedAd? = null
private var isClickScreen: Boolean = true
companion object {
private var _inst: OwVideoAdManager? = null
fun getInstance(): OwVideoAdManager? {
return if (_inst != null) {
_inst
} else {
_inst = OwVideoAdManager()
_inst
}
}
}
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
isClickScreen = true
//创建激励视频事件监听器
val owRewardedAdListener: OWRewardedAdListener = object : OWRewardedAdListener {
override fun onAdReady() {
owRewardedAd?.show(activity)
}
override fun onAdShow(tag: String) {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_OW, Constant.EVENT_TYPE_ZERO, "", "")
}
override fun onAdClick(tag: String) {
if (AppConfig.needReportClickAdEvent) {
TrackManager.getInstance().reportClickAdEvent()
}
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_OW, Constant.EVENT_TYPE_TWO, "", "")
if (isClickScreen) {
// 防止重复
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_OW, Constant.EVENT_TYPE_FOUR, "", "")
isClickScreen = false
}
videoAdStatusListener?.adDownload()
}
override fun onAdClose(tag: String, onewayVideoCloseType: OnewayAdCloseType) {
TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_OW, extraId, curCoin))
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_OW, Constant.EVENT_TYPE_THREE, "", "")
videoAdStatusListener?.adSuccess()
}
override fun onAdFinish(s: String, onewayAdCloseType: OnewayAdCloseType, s1: String) {
}
override fun onSdkError(onewaySdkError: OnewaySdkError, msg: String) {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_OW, Constant.EVENT_TYPE_ONE, "999999","emun:"+onewaySdkError.name+"msg:"+ msg)
videoAdStatusListener?.adFail()
}
}
//创建激励视频对象
owRewardedAd = OWRewardedAd(activity, OwManager.REWARD_PID, owRewardedAdListener)
owRewardedAd?.loadAd()
}
fun setVideoAdStatusListener(videoAdStatusListener: VideoAdStatusListener?) {
this.videoAdStatusListener = videoAdStatusListener
}
override fun onDestroy() {
owRewardedAd?.destory()
owRewardedAd = null
}
}
\ No newline at end of file
...@@ -97,9 +97,14 @@ public class AppConfig { ...@@ -97,9 +97,14 @@ public class AppConfig {
*/ */
public static int ksVideoAdCount = 0; public static int ksVideoAdCount = 0;
/** /**
* rtaVideo 剩余广告播放数 * owVideo 剩余广告播放数
*/ */
public static int rtaVideoAdCount = 0; public static int owVideoAdCount = 0;
// /**
// * rtaVideo 剩余广告播放数
// */
// public static int rtaVideoAdCount = 0;
/** /**
* 高额任务和超级翻倍 csjVideo 剩余广告播放数 * 高额任务和超级翻倍 csjVideo 剩余广告播放数
*/ */
......
...@@ -155,6 +155,7 @@ object Constant { ...@@ -155,6 +155,7 @@ object Constant {
const val AD_SOURCE_SH = "CORAL" //珊瑚天卓 const val AD_SOURCE_SH = "CORAL" //珊瑚天卓
const val AD_SOURCE_KS = "KS" //快手 const val AD_SOURCE_KS = "KS" //快手
const val AD_SOURCE_RTA = "RTA" //RTA const val AD_SOURCE_RTA = "RTA" //RTA
const val AD_SOURCE_OW = "OW" //OneWay
// 调用事件 0 成功 1失败 2点击 3-有效展示 4-去重 // 调用事件 0 成功 1失败 2点击 3-有效展示 4-去重
const val EVENT_TYPE_ZERO = "0" const val EVENT_TYPE_ZERO = "0"
...@@ -177,6 +178,8 @@ object Constant { ...@@ -177,6 +178,8 @@ object Constant {
const val SH_VEDIO_AD = "SH_VEDIO_AD" const val SH_VEDIO_AD = "SH_VEDIO_AD"
const val KS_VEDIO_AD = "KS_VEDIO_AD" const val KS_VEDIO_AD = "KS_VEDIO_AD"
const val RTA_VEDIO_AD = "RTA_VEDIO_AD" const val RTA_VEDIO_AD = "RTA_VEDIO_AD"
const val OW_VEDIO_AD = "OW_VEDIO_AD"
// 信息流广告类型 // 信息流广告类型
const val CSJ_EXPRESS_AD = "CSJ_EXPRESS_AD" const val CSJ_EXPRESS_AD = "CSJ_EXPRESS_AD"
......
package com.mints.goodmoney.manager
import android.app.Application
import com.maplehaze.adsdk.MaplehazeSDK
import mobi.oneway.export.Ad.OnewaySdk
/**
* 描述:OneWay激励视频
* 作者:孟崔广
*/
object OwManager {
private const val PUBLISH_ID = ""
const val REWARD_PID = ""
/**
* 初始化
*/
fun init(application: Application) {
OnewaySdk.configure(application, PUBLISH_ID)
}
}
\ No newline at end of file
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