重构AD部分
This commit is contained in:
parent
41732c8e51
commit
0d2989117f
|
|
@ -56,7 +56,7 @@ public class ADStateUtils {
|
|||
}
|
||||
} else {
|
||||
if (switchRequestListener != null) {
|
||||
switchRequestListener.onSwitchRequestChanged(false);
|
||||
switchRequestListener.onSwitchRequestChanged();
|
||||
switchRequestListener = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -64,7 +64,7 @@ public class ADStateUtils {
|
|||
}
|
||||
|
||||
public interface SwitchRequestListener {
|
||||
void onSwitchRequestChanged(boolean isRequested);
|
||||
void onSwitchRequestChanged();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class SplashUtils {
|
|||
public void run() {
|
||||
long time = DateUtils.currentTimeStamp() - ADConstants.request_splash_time;
|
||||
if (!AdAppUtil.isRunningForeground(mActivity)) {//前台
|
||||
LogAd.e("APP处于前台状态");
|
||||
// LogAd.e("APP处于前台状态");
|
||||
// LogAd.e("相差time=" + time);
|
||||
if (DateUtils.currentTimeStamp() - ADConstants.request_splash_time >= 20) {
|
||||
LogAd.e("应当开启开屏页");
|
||||
|
|
|
|||
82
README.md
82
README.md
|
|
@ -1,32 +1,50 @@
|
|||
com.xxx.xxx.xxx.app
|
||||
├── core/ # 核心基础模块
|
||||
│ ├── constants/ # 常量(如路由、API地址等)
|
||||
│ ├── enums/ # 枚举类
|
||||
│ ├── extensions/ # Kotlin扩展函数
|
||||
│ ├── utils/ # 工具类(可分日期、文件、屏幕工具等子包)
|
||||
│ └── di/ # 核心依赖注入
|
||||
│
|
||||
├── network/ # 网络通信模块
|
||||
│ ├── api/ # 后端接口定义(按业务线分文件)
|
||||
│ ├── model/ # 网络实体类
|
||||
│ ├── interceptor/ # 拦截器(Token刷新、日志等)
|
||||
│ └── retrofit/ # Retrofit配置
|
||||
│
|
||||
├── feature_home/ # 首页功能模块(示例)
|
||||
│ ├── ui/ # 表现层
|
||||
│ │ ├── HomeActivity.kt
|
||||
│ │ ├── HomeFragment.kt
|
||||
│ │ └── HomeViewModel.kt
|
||||
│ │
|
||||
│ ├── domain/ # 领域层(可选)
|
||||
│ └── data/ # 数据层(模块专属仓库)
|
||||
│
|
||||
├── feature_auth/ # 认证模块(示例)
|
||||
│ ├── ui/
|
||||
│ ├── domain/
|
||||
│ └── data/
|
||||
│
|
||||
└── shared/ # 共享模块
|
||||
├── components/ # 公共UI组件(Dialog、自定义View等)
|
||||
├── model/ # 跨模块共享的领域模型
|
||||
└── resources/ # 公共资源(如字符串常量)
|
||||
# 广告模块集成指南
|
||||
## 基础配置(必填项)
|
||||
.addSlot(AD_CODE_SPLASH, "splash_id") // 开屏广告位
|
||||
.addSlot(AD_CODE_REWARD, "reward_id") // 激励视频广告位
|
||||
.addSlot(AD_CODE_FEED, "feed_id") // 信息流广告位
|
||||
.addSlot(AD_CODE_BANNER, "banner_id") // Banner广告位
|
||||
|
||||
.addSlot(AD_APPID, "app_id") // APPID
|
||||
.addSlot(AD_CSJID, "csj_id") // CSJID
|
||||
.addSlot(AD_CODE_SPLASH, "splash_id") // 添加横幅广告位
|
||||
.addSlot(AD_CODE_REWARD, "reward_id") // 激励视频广告位
|
||||
.addSlot(AD_CODE_FEED1, "feed1_id") // 信息流1广告位
|
||||
.addSlot(AD_CODE_FEED2, "feed2_id") // 信息流2广告位
|
||||
.addSlot(AD_CODE_FEED3, "feed3_id") // 信息流3广告位
|
||||
.addSlot(AD_CODE_BANNER, "banner_id") // banner广告位
|
||||
.addSlot(AD_CODE_Draw, "draw_id") // draw广告位
|
||||
|
||||
| 参数 | 类型 | 必填 | 说明 |
|
||||
|-----------|---------|------|----------|
|
||||
| context | Context | ✓ | 应用上下文 |
|
||||
| APP_NAME | String | ✓ | 应用名称 |
|
||||
| CHANNEL | String | ✓ | 渠道 |
|
||||
| AppSplash | int | ✓ | 启动页id |
|
||||
| APPID | String | ✕ | appid |
|
||||
| CSJID | String | ✕ | csjid |
|
||||
| AD_CODE_* | String | ✕ | 各类型广告位id |
|
||||
|
||||
## 调试模式
|
||||
// 开发阶段开启(正式环境需关闭)
|
||||
LogAd.setDebug(true);
|
||||
|
||||
## 最佳实践
|
||||
初始化时机:在Application.onCreate()中完成初始化
|
||||
隐私合规:确保用户已同意隐私政策
|
||||
版本兼容:最低支持Android 7.0(API 24)
|
||||
|
||||
## 初始化失败监听-->重新请求广告开关
|
||||
ADStateUtils.setSwitchRequestListener(new ADStateUtils.SwitchRequestListener() {
|
||||
@Override
|
||||
public void onSwitchRequestChanged() {
|
||||
AdUtils.getAdvFlag();
|
||||
}
|
||||
});
|
||||
|
||||
## 注意事项
|
||||
#### ⚠️ 正式发布前确认:
|
||||
已关闭调试日志6
|
||||
所有广告位ID已测试通过
|
||||
符合广告平台政策要求
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue