问题
I tried integrating InMobi interstitial ad to my android application by following the instructions mentioned here.
Below is the code I have incorporated in my activity class for displaying interstitial ads.
I get no exceptions but every time I run the code, the callback method onInterstitialFailed gets called displaying the message "The ad request was successful but no ad was found".
Looking forward to responses/solutions
interstitial = new IMInterstitial(this,
"I mention the property_id");
interstitial.loadInterstitial();
interstitial.setIMInterstitialListener(new IMInterstitialListener() {
@Override
public void onShowInterstitialScreen(IMInterstitial arg0) {
Log.i("onShowInterstitialScreen", "inside");
}
@Override
public void onLeaveApplication(IMInterstitial arg0) {
Log.i("onLeaveApplication", "inside");
}
@Override
public void onDismissInterstitialScreen(IMInterstitial arg0) {
Log.i("onDismissInterstitialScreen", "inside");
}
@Override
public void onInterstitialLoaded(IMInterstitial arg0) {
if (interstitial.getState() == IMInterstitial.State.READY) {
Log.i("Inside Interstitial Ready state", "Ready");
interstitial.loadInterstitial();
interstitial.show();
}
}
@Override
public void onInterstitialInteraction(IMInterstitial interstitial,
Map<String, String> params) {
Log.i("onInterstitialInteraction", "inside");
}
@Override
public void onInterstitialFailed(IMInterstitial arg0,
IMErrorCode arg1) {
Log.i("onInterstialFailed", "Failed " + arg1);
}
});
回答1:
I work for InMobi.
You should call
interstitial.loadInterstitial() in onInterstitialFailed instead of onInterstitialLoaded() of the call back.
Let me know if this works. Also, can you give me your property ID please?
来源:https://stackoverflow.com/questions/26053583/inmobi-interstitial-ads-are-not-getting-displayed-android