1

I've integrated InMobi into my Android App and it doesn't fetch any ads when the app is first run (Banner or Interstitial).

If I exit the app and then run it again, everything works - Banner and Interstitial is loaded and the banner is displayed.

If I then either uninstall and re-install the app or simply clear the app's cache (from settings) and then run the app again, I'm back to square one and I get nothing. Please note this follows this pattern exactly, it's not random. Always on first run - no ads, always on subsequent runs, ads.

I should point out (in case this is important), I am in test mode (Set in the InMobi dashboard).

Below is the code I have in onCreate - What am I doing wrong?

The error returned in the call backs is simply An error occured while fetching the ad (For both Banner and Interstitial).

There is no further information and nothing on the InMobi website (that I can see). Any help would be appreciated.

    //Initialise Interstitials
    InMobi.initialize(this, myInterstitialID);

    //Initialise Banners
    InMobi.initialize(this, myBannerID);

    //Create the banner
    imbanner = new IMBanner(this, myBannerID, IMBanner.INMOBI_AD_UNIT_320X50);
    //60 second interval refresh
    imbanner.setRefreshInterval(60);
    //Load the banner
    imbanner.loadBanner();

    //Callbacks for the banner ads
    imbanner.setIMBannerListener(new IMBannerListener() {
        @Override
        public void onShowBannerScreen(IMBanner arg0) {             
            Log.v("Inmobi","OnShowBannerScreen");               
                }
            @Override
        public void onLeaveApplication(IMBanner arg0) {
                Log.v("Inmobi","Leave Application");
        }
        @Override
        public void onDismissBannerScreen(IMBanner arg0) {
            Log.v("Inmobi","OnDismissBannerScreen");
        }
                @Override
        public void onBannerRequestFailed(IMBanner banner, IMErrorCode errorCode) {
             Log.v("Inmobi","onBannerRequestFailed: "+errorCode);
        }
        @Override
        public void onBannerRequestSucceeded(IMBanner arg0) {
                Log.v("Inmobi","onBannerRequestSucceeded");
                }
                @Override
        public void onBannerInteraction(IMBanner arg0, Map<String, String> arg1) {  Log.v("Inmobi","onBannerInteraction");
        }
    });

        //Interstitials
        inInterstitial = new IMInterstitial(this, myInterstitialID);
        inInterstitial.loadInterstitial();

        inInterstitial.setIMInterstitialListener(new IMInterstitialListener() {
            public void onShowInterstitialScreen(IMInterstitial arg0) {
                Log.v("Inmobi", "Interstitial showing");
            }
            @Override
            public void onLeaveApplication(IMInterstitial arg0) {
                Log.v("Inmobi", "Interstitial leaving Application");
            }
            @Override
            public void onDismissInterstitialScreen(IMInterstitial arg0) {
                Log.v("Inmobi", "Dismissing Interstitial");
                inInterstitial.loadInterstitial();
            }
            @Override
            public void onInterstitialLoaded(IMInterstitial arg0) {
                Log.v("Inmobi", "Interstitial loaded");
            }
            @Override
            public void onInterstitialInteraction(IMInterstitial interstitial, Map<String, String> params) {                
                Log.v("Inmobi", "Interstitial interaction");
            }
            @Override
            public void onInterstitialFailed(IMInterstitial arg0, IMErrorCode arg1) {
                Log.v("Inmobi", "Interstitial failed: "+arg1);
            }
        }); 
Zippy
  • 3,826
  • 5
  • 43
  • 96
  • Maybe on first run when you call InMobi.initialize(...) they create some token and send it to their servers when making the request for an ad. If the token is not registered there (on first run it cannot be), then they don't return an ad. But on second attempt they send the token again and it's ok. This is just a guess. But in general maybe you should not worry so much if it's only happening on first run. It's even better that the first experience your users will see with your app will not be an advertisment, but instead the app itself :) – luben Sep 09 '15 at 18:35
  • 2
    Just spoke with InMobi support and this is a known bug in the current SDK release, they have a fix and are testing it now so the next release should resolve the problems :-) – Zippy Sep 11 '15 at 12:02

2 Answers2

2

@zippy is right. This is a known behaviour which we've fixed in the upcoming SDK release (tentatively in the next 10 days).

Disclaimer: I'm from the InMobi team and manage the SDK product for InMobi

AJ.
  • 1,146
  • 11
  • 33
0

I am testing inmobi banner ad on genymotion. I faced the same problem. It didn't show anything. Once I closed app and opened again, it showed banner with a message, banner integration successful on the ad itself. But when I tried again after sometime, it didn't show again. I'm using inmobi 5.0.0 sdk.

I am not sure but it seems to be doing one time testing for a particular device id for one banner/ placement ID, I suppose.

justLearning
  • 299
  • 2
  • 7