I'm following this guide here for showing rewarded ads in my application.
At the end of my OnCreate method, I call the following:
private fun loadAdvertisement() {
// Test Ad
rewardedAd = RewardedAd(this,
"ca-app-pub-3940256099942544/5224354917")
val adLoadCallback: RewardedAdLoadCallback = object : RewardedAdLoadCallback() {
override
fun onRewardedAdLoaded() {
Log.d("Ads", "Loaded Ad")
}
override
fun onRewardedAdFailedToLoad(adError: LoadAdError?) {
Log.d("Ads", "Failed to load Ad")
}
}
// Get Personalized Ad Consent
val consentInformation = ConsentInformation.getInstance(applicationContext)
// If Consent is required or unknown, use non personalised
val request = AdRequest.Builder()
val extras = Bundle()
if (consentInformation.consentStatus != ConsentStatus.PERSONALIZED) {
extras!!.putString("npa", "1")
request.addNetworkExtrasBundle(AdMobAdapter::class.java, extras)
}
rewardedAd!!.loadAd(request.build(), adLoadCallback)
}
The Ad load fails with the following error:
{
"Response ID": "null",
"Mediation Adapter Class Name": "",
"Adapter Responses": []
}
zzacn: com.google.android.gms.ads
zzacm: No ad config.
Code: 3
Can anyone see where I'm going wrong here?
Edit
Changing my projects namespace appears to allow test ads, anyone know why that might happen?