| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- import 'dart:io';
- class AdHelper {
- ////////////////// applovin //////////////////
- // applovin ad sdk 初始化需要的sdkkey
- static String applovinSdkKey = 'mycRUJHDmgMv3i2NFQ5L5rB_T2y4HBOIIFR7_gpPd3bDCLep4Bb_KfWTsdWTrafiKMQMOyuAGFDOTTmagsk4LM';
- // 根据是否 lite 版本返回对应的 banner 广告位
- static String getApplovinBannerUnitId(bool isLite) {
- if (Platform.isAndroid) {
- return isLite ? '763f7bbf8e3fe737' : '0c6a650f98d3832e';
- } else if (Platform.isIOS) {
- return '';
- } else {
- return '';
- }
- }
- // 原有 full banner 广告位
- static String get applovinBannerAdUnitId {
- if (Platform.isAndroid) {
- return '0c6a650f98d3832e';
- } else if (Platform.isIOS) {
- return '';
- } else {
- return '';
- }
- }
- // lite banner 广告位
- static String get applovinBannerAdUnitIdLite {
- if (Platform.isAndroid) {
- return '763f7bbf8e3fe737';
- } else if (Platform.isIOS) {
- return '';
- } else {
- return '';
- }
- }
- // 原有 full 插屏广告位
- static String get applovinInterstitialAdUnitId {
- if (Platform.isAndroid) {
- return 'd072aec9f9a9b4a4';
- } else if (Platform.isIOS) {
- return '';
- } else {
- return '';
- }
- }
- // lite 插屏广告位
- static String get applovinInterstitialAdUnitIdLite {
- if (Platform.isAndroid) {
- return '4d06a16999128cca';
- } else if (Platform.isIOS) {
- return '';
- } else {
- return '';
- }
- }
- // 根据是否 lite 版本返回对应的 插屏 广告位
- static String getApplovinInterstitialUnitId(bool isLite) {
- if (Platform.isAndroid) {
- return isLite ? '4d06a16999128cca' : 'd072aec9f9a9b4a4';
- } else if (Platform.isIOS) {
- return '';
- } else {
- return '';
- }
- }
- // 记录广告位
- static String get applovinRewardedAdUnitId {
- if (Platform.isAndroid) {
- return '4e4bf93a3a0314d8';
- } else if (Platform.isIOS) {
- return '';
- } else {
- return '';
- }
- }
- }
- // 定义插屏和激励广告的状态
- enum AdState {
- // 初始状态,广告未加载
- initial,
- // 广告已经ready
- ready,
- // 广告正常显示
- showing,
- // 广告显示异常
- error,
- // 广告视窗关闭
- dismissed,
- }
|