android - Prevent firebase test labs from clicking ads
问题描述
I used Firebase Test Lab to test my app before uploading it to Google Play.
Looking at the screenshots and video it looks like real ads are displayed from admob and then clicked on.
Now I know you can set test devices to show test ads but I cannot find any ids for firebase test devices, or can I in code somehow identify that this is a robo test so I can prevent real ads?
Also I wonder if google play pre launch report tests has the same issues?
解决方案
您可以通过查找官方文档中记录的环境变量来检测设备是否在代码中的Firebase 测试实验室中运行。firebase.test.lab
String testLabSetting = Settings.System.getString(getContentResolver(), "firebase.test.lab");
if ("true".equals(testLabSetting)) {
// Do something when running in Test Lab
}
这同样适用于 Google Play 预发布报告。
推荐阅读
- r - 使用 group_map 将函数应用于分组小标题中的每个组
- java - 如何将 RGB 图像转换为 CIELUV 颜色空间?
- apache-storm - 风暴消息超时工作不正常
- c# - 列出解决方案文件夹中作为资源构建的 PNG 文件的所有路径
- sql - 身份规范
- java - 在测试或测试类之后清除 JMockit 期望
- php - 有没有办法通过 symfony 中的符号链接来定义实体?
- kubernetes - Kubernetes 中暴露的服务和副本集关系
- python - 在 Python Tkinter 的窗口中间的列之间放置一条网格垂直线
- json - 从邮递员解析 json 后出现问题