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