调整 测试广告位

This commit is contained in:
Jin857 2024-11-27 09:19:05 +08:00
parent 61f484c80c
commit ae47b75a30
3 changed files with 21 additions and 79 deletions

View File

@ -47,7 +47,6 @@ internal class SplashAdView(
} }
private fun loadSplashAd() { private fun loadSplashAd() {
LogUtil.e("codeId: $codeId , fetchDelay: $fetchDelay")
splashAD = SplashAD(activity, codeId, this, fetchDelay) splashAD = SplashAD(activity, codeId, this, fetchDelay)
mContainer?.removeAllViews() mContainer?.removeAllViews()
splashAD?.fetchAdOnly() splashAD?.fetchAdOnly()

View File

@ -1,10 +1,9 @@
/// 广 /// 广
class AdsConfig { class AdsConfig {
static String androidAppId = "1208618114"; static String androidAppId = "1208641399";
static String iosAppId = "1208619454"; static String iosAppId = "1208619454";
// static String androidSplashId = "5172884622215995"; static String androidSplashId = "8192585647453217";
static String androidSplashId = "1122289510576542";
static String iosSplashId = "7142786521331351"; static String iosSplashId = "7142786521331351";
static String androidInterstitialId = "1066865274941328"; static String androidInterstitialId = "1066865274941328";
@ -19,7 +18,7 @@ class AdsConfig {
static String iosInterstitialRewardVideoId = "9022927550132316"; static String iosInterstitialRewardVideoId = "9022927550132316";
/// 广id /// 广id
static String androidRewardVideoId = "7162486540988491"; static String androidRewardVideoId = "5162488667064787";
static String iosRewardVideoId = "6102886561536594"; static String iosRewardVideoId = "6102886561536594";
/// Banner 广id /// Banner 广id

View File

@ -30,35 +30,35 @@ class _HomePageState extends State<HomePage> {
//广 //广
flutterTencentadRewardCallBack: FlutterUnionAdRewardCallBack( flutterTencentadRewardCallBack: FlutterUnionAdRewardCallBack(
onShow: () { onShow: () {
print("激励广告显示"); debugPrint("激励广告显示");
}, },
onClick: () { onClick: () {
print("激励广告点击"); debugPrint("激励广告点击");
}, },
onFail: (code, message) { onFail: (code, message) {
print("激励广告失败 $code $message"); debugPrint("激励广告失败 $code $message");
}, },
onClose: () { onClose: () {
print("激励广告关闭"); debugPrint("激励广告关闭");
}, },
onReady: () async { onReady: () async {
print("激励广告预加载准备就绪"); debugPrint("激励广告预加载准备就绪");
await FlutterUnionAd.showRewardVideoAd(); await FlutterUnionAd.showRewardVideoAd();
}, },
onUnReady: () { onUnReady: () {
print("激励广告预加载未准备就绪"); debugPrint("激励广告预加载未准备就绪");
}, },
onVerify: (transId, rewardName, rewardAmount) { onVerify: (transId, rewardName, rewardAmount) {
print("激励广告奖励 $transId $rewardName $rewardAmount"); debugPrint("激励广告奖励 $transId $rewardName $rewardAmount");
}, },
onExpose: () { onExpose: () {
print("激励广告曝光"); debugPrint("激励广告曝光");
}, },
onFinish: () { onFinish: () {
print("激励广告完成"); debugPrint("激励广告完成");
}, },
onECPM: (ecpmLevel, ecpm) async { onECPM: (ecpmLevel, ecpm) async {
print("激励广告竞价 ecpmLevel=$ecpmLevel ecpm=$ecpm"); debugPrint("激励广告竞价 ecpmLevel=$ecpmLevel ecpm=$ecpm");
// //
if (ecpm > 0) { if (ecpm > 0) {
//Integer //Integer
@ -73,53 +73,9 @@ class _HomePageState extends State<HomePage> {
result: FlutterUnioAdBiddingResult().fail( result: FlutterUnioAdBiddingResult().fail(
1000, 1000,
FlutterTencentAdBiddingLossReason.LOW_PRICE, FlutterTencentAdBiddingLossReason.LOW_PRICE,
FlutterTencentAdADNID.othoerADN)); FlutterTencentAdADNID.othoerADN,
}
},
), ),
flutterTencentadInteractionCallBack: FlutterUnionAdInteractionCallBack( );
onShow: () {
print("插屏广告显示");
},
onClick: () {
print("插屏广告点击");
},
onFail: (code, message) {
print("插屏广告失败 $code $message");
},
onClose: () {
print("插屏广告关闭");
},
onExpose: () {
print("插屏广告曝光");
},
onReady: () async {
print("插屏广告预加载准备就绪");
await FlutterUnionAd.showUnifiedInterstitialAD();
},
onUnReady: () {
print("插屏广告预加载未准备就绪");
},
onVerify: (transId, rewardName, rewardAmount) {
print("插屏广告奖励凭证id $transId");
},
onECPM: (ecpmLevel, ecpm) async {
print("插屏广告竞价 ecpmLevel=$ecpmLevel ecpm=$ecpm");
//
if (ecpm > 0) {
//Integer
//Integer
await FlutterUnionAd.showUnifiedInterstitialAD(
result: FlutterUnioAdBiddingResult().success(ecpm, 0));
} else {
//Integer
//广 FlutterTencentAdBiddingLossReason
//ID FlutterTencentAdADNID
await FlutterUnionAd.showUnifiedInterstitialAD(
result: FlutterUnioAdBiddingResult().fail(
1000,
FlutterTencentAdBiddingLossReason.LOW_PRICE,
FlutterTencentAdADNID.othoerADN));
} }
}, },
), ),
@ -141,9 +97,8 @@ class _HomePageState extends State<HomePage> {
Text('当前版本: $adVersion'), Text('当前版本: $adVersion'),
const SizedBox(height: 20), const SizedBox(height: 20),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
const SizedBox(height: 20),
ElevatedButton( ElevatedButton(
child: const Text('开屏(全屏)'), child: const Text('开屏(全屏)'),
onPressed: () { onPressed: () {
@ -151,17 +106,6 @@ class _HomePageState extends State<HomePage> {
setState(() {}); setState(() {});
}, },
), ),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
ElevatedButton(
child: const Text('插屏激励'),
onPressed: () {
showInterstitialAd();
},
),
const SizedBox(height: 20), const SizedBox(height: 20),
ElevatedButton( ElevatedButton(
child: const Text('激励视频'), child: const Text('激励视频'),
@ -206,7 +150,7 @@ class _HomePageState extends State<HomePage> {
/// 广 /// 广
Future<void> showSplashAd(context) async { Future<void> showSplashAd(context) async {
Navigator.push( await Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (_) { builder: (_) {