Commit 5aa368b8 authored by mengcuiguang's avatar mengcuiguang

更换保活版本

parent d9780f9a
...@@ -256,9 +256,9 @@ dependencies { ...@@ -256,9 +256,9 @@ dependencies {
// 保活相关 // 保活相关
implementation 'me.weishu:free_reflection:2.2.0' implementation 'me.weishu:free_reflection:2.2.0'
implementation(name: 'alive-sdk-v3.1.5-release', ext: 'aar') implementation(name: 'alive-sdk-v3.3.3-release', ext: 'aar')
implementation(name: 'alive-plugin-music-sdk-v3.0.2-release', ext: 'aar') implementation(name: 'alive-plugin-music-sdk-v3.0.3-release', ext: 'aar')
implementation(name: 'keepalive-sdk-v3.1.4-release', ext: 'aar') implementation(name: 'keepalive-sdk-v3.3.2-release', ext: 'aar')
implementation(name: 'libbase-sdk-v3.0.3-release', ext: 'aar') implementation(name: 'libbase-sdk-v3.0.3-release', ext: 'aar')
implementation(name: 'net_native-v3.1.3.22-release', ext: 'aar') implementation(name: 'net_native-v3.1.3.22-release', ext: 'aar')
implementation 'org.greenrobot:eventbus:3.1.1' implementation 'org.greenrobot:eventbus:3.1.1'
......
...@@ -4,24 +4,23 @@ import android.app.Activity; ...@@ -4,24 +4,23 @@ import android.app.Activity;
import android.util.Log; import android.util.Log;
import com.bytedance.msdk.api.AdError; import com.bytedance.msdk.api.AdError;
import com.bytedance.msdk.api.AdSlot; import com.bytedance.msdk.api.v2.GMAdConstant;
import com.bytedance.msdk.api.TTAdConstant; import com.bytedance.msdk.api.v2.GMMediationAdSdk;
import com.bytedance.msdk.api.TTMediationAdSdk; import com.bytedance.msdk.api.v2.GMSettingConfigCallback;
import com.bytedance.msdk.api.TTSettingConfigCallback; import com.bytedance.msdk.api.v2.ad.fullvideo.GMFullVideoAd;
import com.bytedance.msdk.api.TTVideoOption; import com.bytedance.msdk.api.v2.ad.fullvideo.GMFullVideoAdListener;
import com.bytedance.msdk.api.fullVideo.TTFullVideoAd; import com.bytedance.msdk.api.v2.ad.fullvideo.GMFullVideoAdLoadCallback;
import com.bytedance.msdk.api.fullVideo.TTFullVideoAdListener; import com.bytedance.msdk.api.v2.slot.GMAdOptionUtil;
import com.bytedance.msdk.api.fullVideo.TTFullVideoAdLoadCallback; import com.bytedance.msdk.api.v2.slot.GMAdSlotFullVideo;
import com.mints.fiveworld.ad.AdHelper; import com.mints.fiveworld.ad.AdHelper;
import com.mints.fiveworld.ad.AdReportManager; import com.mints.fiveworld.ad.AdReportManager;
import com.mints.fiveworld.ad.wifi.WifiAdStatusListener; import com.mints.fiveworld.ad.wifi.WifiAdStatusListener;
import com.mints.fiveworld.common.Constant; import com.mints.fiveworld.common.Constant;
import com.mints.fiveworld.manager.ad.CsjGroMoreManager;
import com.mints.fiveworld.manager.TrackManager; import com.mints.fiveworld.manager.TrackManager;
import com.mints.fiveworld.manager.UserManager; import com.mints.fiveworld.manager.UserManager;
import com.mints.fiveworld.manager.ad.CsjGroMoreManager;
import com.mints.fiveworld.utils.LogUtil; import com.mints.fiveworld.utils.LogUtil;
import com.mints.fiveworld.utils.TimeRender; import com.mints.fiveworld.utils.TimeRender;
import com.mints.fiveworld.utils.VideoOptionUtil;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.HashMap; import java.util.HashMap;
...@@ -44,7 +43,7 @@ public class InSceneFull { ...@@ -44,7 +43,7 @@ public class InSceneFull {
private WifiAdStatusListener wifiAdStatusListener; private WifiAdStatusListener wifiAdStatusListener;
private TTFullVideoAd mTTFullVideoAd; private GMFullVideoAd mTTFullVideoAd;
private WeakReference<Activity> activity; private WeakReference<Activity> activity;
private String fullId; private String fullId;
private boolean isClickScreen = true; // 是否点击屏幕跳转广告 private boolean isClickScreen = true; // 是否点击屏幕跳转广告
...@@ -74,10 +73,10 @@ public class InSceneFull { ...@@ -74,10 +73,10 @@ public class InSceneFull {
LogUtil.d(TAG, "gromore应用内全屏广告-> 2、执行预加载去了=" + isLoadSuccess); LogUtil.d(TAG, "gromore应用内全屏广告-> 2、执行预加载去了=" + isLoadSuccess);
if (TTMediationAdSdk.configLoadSuccess()) { if (GMMediationAdSdk.configLoadSuccess()) {
loadAd(); loadAd();
} else { } else {
TTMediationAdSdk.registerConfigCallback(mSettingConfigCallback); GMMediationAdSdk.registerConfigCallback(mSettingConfigCallback);
} }
} }
} }
...@@ -85,7 +84,12 @@ public class InSceneFull { ...@@ -85,7 +84,12 @@ public class InSceneFull {
/** /**
* config回调 * config回调
*/ */
private final TTSettingConfigCallback mSettingConfigCallback = this::loadAd; private GMSettingConfigCallback mSettingConfigCallback = new GMSettingConfigCallback() {
@Override
public void configLoad() {
loadAd();
}
};
private void loadAd() { private void loadAd() {
fullId = getFullId(); fullId = getFullId();
...@@ -107,28 +111,20 @@ public class InSceneFull { ...@@ -107,28 +111,20 @@ public class InSceneFull {
/** /**
* 选择的模板类型 * 注:每次加载全屏视频广告的时候需要新建一个GMFullVideoAd,否则可能会出现广告填充问题
* 如果服务端配置了模板类型跟随服务端配置 * ( 例如:mTTFullVideoAd = new GMFullVideoAd(this, adUnitId);)
* 有效值 0 客户端设置生效 1 原生 2 模板 1.0 3 模板 2.0
* 服务端没有下发数值客户端设置模板版本才会生效
*/ */
/** mTTFullVideoAd = new GMFullVideoAd(activity.get(), fullId);
* 注:每次加载全屏视频广告的时候需要新建一个TTFullVideoAd,否则可能会出现广告填充问题
* ( 例如:mTTFullVideoAd = new TTFullVideoAd(this, adUnitId);)
*/
mTTFullVideoAd = new TTFullVideoAd(activity.get(), fullId);
//声音控制 模板 2.0
TTVideoOption videoOption = VideoOptionUtil.getTTVideoOption2();
//创建广告请求参数AdSlot,具体参数含义参考文档 GMAdSlotFullVideo adSlotFullVideo = new GMAdSlotFullVideo.Builder()
AdSlot.Builder adSlotBuilder = new AdSlot.Builder() .setGMAdSlotGDTOption(GMAdOptionUtil.getGMAdSlotGDTOption().build())
.setTTVideoOption(videoOption)//设置声音控制 .setGMAdSlotBaiduOption(GMAdOptionUtil.getGMAdSlotBaiduOption().build())
.setUserID(UserManager.getInstance().getUserID())//用户id,必传参数 .setUserID(UserManager.getInstance().getUserID())//用户id,必传参数
.setMediaExtra("media_extra") //附加参数,可选 .setOrientation(GMAdConstant.VERTICAL)//必填参数,期望视频的播放方向:TTAdConstant.HORIZONTAL 或 TTAdConstant.VERTICAL;
.setOrientation(TTAdConstant.VERTICAL);//必填参数,期望视频的播放方向:TTAdConstant.HORIZONTAL 或 TTAdConstant.VERTICAL; .build();
//请求广告 //请求广告
mTTFullVideoAd.loadFullAd(adSlotBuilder.build(), new TTFullVideoAdLoadCallback() { mTTFullVideoAd.loadAd(adSlotFullVideo.build(), new GMFullVideoAdLoadCallback() {
@Override @Override
public void onFullVideoLoadFail(AdError adError) { public void onFullVideoLoadFail(AdError adError) {
...@@ -157,6 +153,16 @@ public class InSceneFull { ...@@ -157,6 +153,16 @@ public class InSceneFull {
@Override @Override
public void onFullVideoAdLoad() { public void onFullVideoAdLoad() {
LogUtil.d(TAG, "gromore应用内全屏广告--> 3、Gromore 新插屏onFullVideoAdLoad "); LogUtil.d(TAG, "gromore应用内全屏广告--> 3、Gromore 新插屏onFullVideoAdLoad ");
isLoadSuccess = 2;
adLoadTime = System.currentTimeMillis();
}
@Override
public void onFullVideoCached() {
isLoadSuccess = 2;
adLoadTime = System.currentTimeMillis();
if (mTTFullVideoAd != null) { if (mTTFullVideoAd != null) {
adcode = mTTFullVideoAd.getAdNetworkRitId(); adcode = mTTFullVideoAd.getAdNetworkRitId();
ecpm = mTTFullVideoAd.getPreEcpm(); ecpm = mTTFullVideoAd.getPreEcpm();
...@@ -177,17 +183,9 @@ public class InSceneFull { ...@@ -177,17 +183,9 @@ public class InSceneFull {
"" ""
); );
isLoadSuccess = 2;
adLoadTime = System.currentTimeMillis();
if (wifiAdStatusListener != null) { if (wifiAdStatusListener != null) {
wifiAdStatusListener.adSuccess(); wifiAdStatusListener.adSuccess();
} }
}
@Override
public void onFullVideoCached() {
isLoadSuccess = 2;
adLoadTime = System.currentTimeMillis();
LogUtil.d(TAG, "gromore应用内全屏广告--> 3、Gromore 新插屏onFullVideoCached "); LogUtil.d(TAG, "gromore应用内全屏广告--> 3、Gromore 新插屏onFullVideoCached ");
} }
...@@ -224,7 +222,8 @@ public class InSceneFull { ...@@ -224,7 +222,8 @@ public class InSceneFull {
//在获取到广告后展示,强烈建议在onRewardVideoCached回调后,展示广告,提升播放体验 //在获取到广告后展示,强烈建议在onRewardVideoCached回调后,展示广告,提升播放体验
//该方法直接展示广告 //该方法直接展示广告
//展示广告,并传入广告展示的场景 //展示广告,并传入广告展示的场景
mTTFullVideoAd.showFullAd(this.activity.get(), mTTFullVideoAdListener); mTTFullVideoAd.setFullVideoAdListener(mTTFullVideoAdListener);
mTTFullVideoAd.showFullAd(this.activity.get());
} else { } else {
LogUtil.d(TAG, "gromore应用内全屏广告--> 5、展示广告时失败了,广告可能超时45分钟 onError "); LogUtil.d(TAG, "gromore应用内全屏广告--> 5、展示广告时失败了,广告可能超时45分钟 onError ");
...@@ -256,7 +255,7 @@ public class InSceneFull { ...@@ -256,7 +255,7 @@ public class InSceneFull {
/** /**
* 激励视频交互回调 * 激励视频交互回调
*/ */
private final TTFullVideoAdListener mTTFullVideoAdListener = new TTFullVideoAdListener() { private final GMFullVideoAdListener mTTFullVideoAdListener = new GMFullVideoAdListener() {
@Override @Override
public void onFullVideoAdShow() { public void onFullVideoAdShow() {
......
...@@ -10,12 +10,16 @@ import android.widget.FrameLayout; ...@@ -10,12 +10,16 @@ import android.widget.FrameLayout;
import com.bytedance.msdk.adapter.pangle.PangleNetworkRequestInfo; import com.bytedance.msdk.adapter.pangle.PangleNetworkRequestInfo;
import com.bytedance.msdk.api.AdError; import com.bytedance.msdk.api.AdError;
import com.bytedance.msdk.api.AdSlot;
import com.bytedance.msdk.api.NetworkPlatformConst; import com.bytedance.msdk.api.NetworkPlatformConst;
import com.bytedance.msdk.api.TTNetworkRequestInfo;
import com.bytedance.msdk.api.splash.TTSplashAd;
import com.bytedance.msdk.api.splash.TTSplashAdListener; import com.bytedance.msdk.api.splash.TTSplashAdListener;
import com.bytedance.msdk.api.splash.TTSplashAdLoadCallback; import com.bytedance.msdk.api.GMAdEcpmInfo;
import com.bytedance.msdk.api.v2.GMAdConstant;
import com.bytedance.msdk.api.v2.GMNetworkPlatformConst;
import com.bytedance.msdk.api.v2.GMNetworkRequestInfo;
import com.bytedance.msdk.api.v2.ad.splash.GMSplashAd;
import com.bytedance.msdk.api.v2.ad.splash.GMSplashAdListener;
import com.bytedance.msdk.api.v2.ad.splash.GMSplashAdLoadCallback;
import com.bytedance.msdk.api.v2.slot.GMAdSlotSplash;
import com.mints.fiveworld.MintsApplication; import com.mints.fiveworld.MintsApplication;
import com.mints.fiveworld.R; import com.mints.fiveworld.R;
import com.mints.fiveworld.ad.AdHelper; import com.mints.fiveworld.ad.AdHelper;
...@@ -25,10 +29,9 @@ import com.mints.fiveworld.common.Constant; ...@@ -25,10 +29,9 @@ import com.mints.fiveworld.common.Constant;
import com.mints.fiveworld.common.DeviceInfo; import com.mints.fiveworld.common.DeviceInfo;
import com.mints.fiveworld.keepalive.appswitch.AntiAuditManager; import com.mints.fiveworld.keepalive.appswitch.AntiAuditManager;
import com.mints.fiveworld.manager.AppPreferencesManager; import com.mints.fiveworld.manager.AppPreferencesManager;
import com.mints.fiveworld.manager.ad.CsjGroMoreManager;
import com.mints.fiveworld.manager.TrackManager; import com.mints.fiveworld.manager.TrackManager;
import com.mints.fiveworld.manager.UmengManager; import com.mints.fiveworld.manager.UmengManager;
import com.mints.fiveworld.manager.ad.TTGroMoreAdManagerHolder; import com.mints.fiveworld.manager.ad.CsjGroMoreManager;
import com.mints.fiveworld.mvp.model.SplashAppBean; import com.mints.fiveworld.mvp.model.SplashAppBean;
import com.mints.fiveworld.mvp.presenters.SplashPresenter; import com.mints.fiveworld.mvp.presenters.SplashPresenter;
import com.mints.fiveworld.mvp.views.SplashView; import com.mints.fiveworld.mvp.views.SplashView;
...@@ -53,7 +56,7 @@ public class SplashActivity extends BaseActivity implements SplashView { ...@@ -53,7 +56,7 @@ public class SplashActivity extends BaseActivity implements SplashView {
PowerDialog powerDialog; PowerDialog powerDialog;
private static final String TAG = "SplashActivity"; private static final String TAG = "SplashActivity";
private TTSplashAd mTTSplashAd; private GMSplashAd mTTSplashAd;
private FrameLayout mSplashContainer; private FrameLayout mSplashContainer;
//是否强制跳转到主页面 //是否强制跳转到主页面
private boolean mForceGoMain; private boolean mForceGoMain;
...@@ -134,22 +137,30 @@ public class SplashActivity extends BaseActivity implements SplashView { ...@@ -134,22 +137,30 @@ public class SplashActivity extends BaseActivity implements SplashView {
* 注:每次加载开屏广告的时候需要新建一个TTSplashAd,否则可能会出现广告填充问题 * 注:每次加载开屏广告的时候需要新建一个TTSplashAd,否则可能会出现广告填充问题
* ( 例如:mTTSplashAd = new TTSplashAd(this, mAdUnitId);) * ( 例如:mTTSplashAd = new TTSplashAd(this, mAdUnitId);)
*/ */
mTTSplashAd = new TTSplashAd(this, adUnitId); mTTSplashAd = new GMSplashAd(this, adUnitId);
mTTSplashAd.setTTAdSplashListener(mSplashAdListener); mTTSplashAd.setAdSplashListener(mSplashAdListener);
//step3:创建开屏广告请求参数AdSlot,具体参数含义参考文档 //step3:创建开屏广告请求参数AdSlot,具体参数含义参考文档
AdSlot adSlot = new AdSlot.Builder() GMAdSlotSplash adSlot = new GMAdSlotSplash.Builder()
.setImageAdSize(1080, 1920) // 既适用于原生类型,也适用于模版类型。 .setImageAdSize(1080, 1920) // 既适用于原生类型,也适用于模版类型。
.setTimeOut(AD_TIME_OUT)//设置超时
.setSplashButtonType(GMAdConstant.SPLASH_BUTTON_TYPE_FULL_SCREEN)
.setDownloadType(GMAdConstant.DOWNLOAD_TYPE_POPUP)
.build(); .build();
//自定义兜底方案 选择使用 //自定义兜底方案 选择使用
// TTNetworkRequestInfo ttNetworkRequestInfo; GMNetworkRequestInfo gmNetworkRequestInfo;
// //穿山甲兜底 //穿山甲兜底,参数分别是appId和adn代码位。注意第二个参数是代码位,而不是广告位。
// ttNetworkRequestInfo = new PangleNetworkRequestInfo(TTGroMoreAdManagerHolder.CURRENT_USE_APPID, CsjGroMoreManager.INSTANCE.getInMoneySplashIdAdCode()); // gmNetworkRequestInfo = new PangleNetworkRequestInfo("5001121", "887382976");
//gdt兜底
//step4:请求广告,调用开屏广告异步请求接口,对请求回调的广告作渲染处理 // gmNetworkRequestInfo = new GdtNetworkRequestInfo("1101152570", "8863364436303842593");
// mTTSplashAd.loadAd(adSlot, ttNetworkRequestInfo, new TTSplashAdLoadCallback() { //ks兜底
mTTSplashAd.loadAd(adSlot, new TTSplashAdLoadCallback() { // gmNetworkRequestInfo = new KsNetworkRequestInfo("90009", "4000000042");
//百度兜底
// gmNetworkRequestInfo = new BaiduNetworkRequestInfo("e866cfb0", "2058622");
// mTTSplashAd.loadAd(adSlot, gmNetworkRequestInfo, new GMSplashAdLoadCallback() {
mTTSplashAd.loadAd(adSlot, new GMSplashAdLoadCallback() {
@Override @Override
public void onSplashAdLoadFail(AdError adError) { public void onSplashAdLoadFail(AdError adError) {
mProgressBar.post(() -> mProgressBar.setCompleteNoAnim()); mProgressBar.post(() -> mProgressBar.setCompleteNoAnim());
...@@ -236,11 +247,11 @@ public class SplashActivity extends BaseActivity implements SplashView { ...@@ -236,11 +247,11 @@ public class SplashActivity extends BaseActivity implements SplashView {
); );
} }
} }
}, AD_TIME_OUT); });
} }
TTSplashAdListener mSplashAdListener = new TTSplashAdListener() { GMSplashAdListener mSplashAdListener = new GMSplashAdListener() {
@Override @Override
public void onAdClicked() { public void onAdClicked() {
baiduSplashAdClicked = true; baiduSplashAdClicked = true;
......
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