I am trying to load interstitial advertisements for my app. Whenever I try to load these ads I get a Error saying "No Ads Config" from Domain "com.google.android.gms.ads".
Here is the code:
My AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ayush.torch">
<application
android:allowBackup="true"
android:icon="@drawable/ic_ico"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".main">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="i_have_put_my_app_id_here"/>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
</manifest>
onCreate() in main.java
// Creating the InterstitialAd and setting the adUnitId.
interstitialAd = new InterstitialAd(this);
interstitialAd.setAdUnitId("i have also put my interstitial ad id here");
interstitialAd.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
Toast.makeText(main.this, "Ad Loaded", Toast.LENGTH_SHORT).show();
}
@Override
public void onAdFailedToLoad(LoadAdError loadAdError) {
String error = String.format("domain: %s, code: %d, message: %s", loadAdError.getDomain(), loadAdError.getCode(), loadAdError.getMessage());
Toast.makeText(main.this, "onAdFailedToLoad() with error: " + error, Toast.LENGTH_SHORT).show();
}
});
When I load my ad in a on function it gives me error "No Ad Config."
Log.d("[Ads]","Ad Load State For on(): " + interstitialAd.isLoaded());
if (interstitialAd.isLoaded())
{
interstitialAd.show();
}