When I was looking at the pre-launch report of my app, as well in play console as in firebase, I got the feeling that the ads where being clicked. Is there a way to detect test devices and eventually not display the banner?
The automated tests do click on the ads and sometimes even open the internet browser, so the pre-launch report is messed up. Also, this triggers actual ad impressions, which is against the AdMob policies.
To workaround this, the only solution I found is to detect whether the app is running on a test device and hide the ads accordingly.
To check if you are on a test device:
private fun isTestDevice(): Boolean {
val testLabSetting: String? = Settings.System.getString(contentResolver, "firebase.test.lab")
return "true" == testLabSetting
}
To display the ads only on non-test devices:
if(!isTestDevice()) {
AdViewCompose(adUnitId = adUnitId)
}