WinBoLL 广告ID区分beta与stage版本。
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Sun Nov 16 05:02:05 GMT 2025
|
||||
#Sun Nov 16 05:25:19 GMT 2025
|
||||
stageCount=0
|
||||
libraryProject=
|
||||
baseVersion=15.11
|
||||
publishVersion=15.11.0
|
||||
buildCount=50
|
||||
buildCount=51
|
||||
baseBetaVersion=15.11.1
|
||||
|
||||
@@ -57,7 +57,9 @@ public class MainActivity extends WinBoLLActivity {
|
||||
private SharedPreferences mSharedPreferences;
|
||||
|
||||
private String BANNER_POS_ID = "802e356f1726f9ff39c69308bfd6f06a";
|
||||
private String BANNER_POS_ID_WINBOLL = "d129ee5a263911f981a6dc7a9802e3e7";
|
||||
private String BANNER_POS_ID_WINBOLL_BETA = "d129ee5a263911f981a6dc7a9802e3e7";
|
||||
private String BANNER_POS_ID_WINBOLL = "4ec30efdb32271765b9a4efac902828b";
|
||||
|
||||
private BannerAd mBannerAd;
|
||||
private List<BannerAd> mAllBanners = new ArrayList<>();
|
||||
|
||||
@@ -505,7 +507,7 @@ public class MainActivity extends WinBoLLActivity {
|
||||
}
|
||||
});
|
||||
|
||||
String currentAD_ID = isEvenSecond()?BANNER_POS_ID_WINBOLL: BANNER_POS_ID;
|
||||
String currentAD_ID = getAD_ID();
|
||||
LogUtils.d(TAG, String.format("currentAD_ID = %s", currentAD_ID));
|
||||
ADParams params = new ADParams.Builder().setUpId(currentAD_ID).build();
|
||||
mBannerAd.loadAd(params, new BannerAd.BannerLoadListener() {
|
||||
@@ -543,13 +545,17 @@ public class MainActivity extends WinBoLLActivity {
|
||||
* 判断当前时间是单数秒还是双数秒
|
||||
* @return true:双数秒(0、2、4...),false:单数秒(1、3、5...)
|
||||
*/
|
||||
private boolean isEvenSecond() {
|
||||
private String getAD_ID() {
|
||||
// 1. 获取当前毫秒级时间戳
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
// 2. 转换为秒数(毫秒 ÷ 1000,向下取整)
|
||||
long currentSecond = currentTimeMillis / 1000;
|
||||
// 3. 对 2 取余:余数为 0 是双数秒,余数为 1 是单数秒
|
||||
return currentSecond % 2 == 0;
|
||||
if(currentSecond % 2 == 0) {
|
||||
return BANNER_POS_ID;
|
||||
} else {
|
||||
return BuildConfig.DEBUG?BANNER_POS_ID_WINBOLL_BETA:BANNER_POS_ID_WINBOLL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user