Inmobi Interstitial ad gives error "The ad request was successful, but no ad was returned" in diagnostics

2.5k views Asked by At

I'm trying to integrate InMobi in my app and I can show banner ads successfully but unable to add interstitial ads.

I've added this code in the activity from where I want to show ad.

    InMobi.setLogLevel(InMobi.LOG_LEVEL.DEBUG);
    InMobi.initialize(this, "Property-id");

    final IMInterstitial interstitial = new IMInterstitial(this, "Property-id");
    interstitial.setIMInterstitialListener(new IMInterstitialListener() {
        @Override
        public void onInterstitialFailed(IMInterstitial imInterstitial, IMErrorCode imErrorCode) {
            Log.e(DEBUG_TAG, "Interstitial failed" + "... Error code = " + imErrorCode +
                    "... Internstial = " + imInterstitial);
        }

        @Override
        public void onInterstitialLoaded(IMInterstitial imInterstitial) {
            Log.e(DEBUG_TAG, "interstitial loaded");
            if (interstitial.getState() == IMInterstitial.State.READY) {
                interstitial.show();
            }
        }

        @Override
        public void onShowInterstitialScreen(IMInterstitial imInterstitial) {
        }

        @Override
        public void onDismissInterstitialScreen(IMInterstitial imInterstitial) {
        }

        @Override
        public void onInterstitialInteraction(IMInterstitial imInterstitial, Map<String, String> stringStringMap) {
        }

        @Override
        public void onLeaveApplication(IMInterstitial imInterstitial) {
        }
    });
    interstitial.loadInterstitial();

And for testing, I've added everything mentioned here in AndroidManifest.xml file. I've added all the permissions there, hardwareAccelerated=true in application tag and this:

    <activity
        android:name="com.inmobi.androidsdk.IMBrowserActivity"
        android:configChanges="keyboardHidden|orientation|keyboard|smallestScreenSize|screenSize"
        android:hardwareAccelerated="true"
        android:theme="@android:style/Theme.Translucent.NoTitleBar" />

    <receiver
        android:name="com.inmobi.commons.analytics.androidsdk.IMAdTrackerReceiver"
        android:enabled="true"
        android:exported="true" >
        <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
            <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
            <action android:name="com.inmobi.share.id" />
        </intent-filter>
    </receiver>

    <service
            android:name="com.inmobi.commons.internal.ActivityRecognitionManager"
            android:enabled="true" />

But I keep getting this error "The ad request was successful, but no ad was returned" and after a small time gap, it gives "Ad network failed to retrieve ad".

For banner ads it worked successfully though. I tried it again but it's not working now. Is there something wrong with inmobi diagnostics as mentioned here (Sohan says this in his comments).

1

There are 1 answers

7
AJ. On

I'm from the InMobi team. Are you replacing the "Property-Id" in your code with your actual property id? I'm unsure if the code you provided above is your actual code or for illustrative purposes only...