首页 > 解决方案 > 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?

标签: androidfirebaseadmobfirebase-test-lab

解决方案


您可以通过查找官方文档中记录的环境变量来检测设备是否在代码中的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 预发布报告。


推荐阅读