0

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).

Community
  • 1
  • 1
Shivam Mangla
  • 92
  • 6
  • 16

1 Answers1

1

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...

AJ.
  • 1,146
  • 11
  • 33
  • Yes, I was using a property key I generated on InMobi site. I think I would have got some other error otherwise. Right now it says that the request was made successfully. It turns out that the code is fine. It had to do something with fill rate I think and that's why I was unable to see the code. I see ads sometimes. So, thanks for answering. :) – Shivam Mangla Dec 14 '14 at 15:20
  • Happy to help :) Please feel free to reach out to us through the contact form available within your account for any help – AJ. Dec 15 '14 at 03:40
  • I have this problem too. What's the solution? – fish40 Jul 07 '15 at 09:21
  • Could you not just fire an ad request off to another network (AdMob for example) when InMobi fails to provide one (ie, when the onInterstitialFailed callback fires) This would at least greatly increase your chances of getting an ad. – Zippy Sep 11 '15 at 12:41
  • The best way to test your integration is via the test mode/diagnostic mode. It will return 100% fill to allow you to test your integration. – AJ. Sep 12 '15 at 08:02
  • I get an error like "Failed to fetch ad for placement id: MY_PLACEMENT_ID, reason phrase available in onAdLoadFailed callback." and then you search for this error on internet and on this url , you wont get solution. Worst ad SDK I have ever seen till date. – Kishan Solanki Mar 25 '19 at 05:32
  • Mister AJ I am having same issue. Any solution for this https://stackoverflow.com/q/59310204/1363087 – Ton Dec 12 '19 at 17:49