我正在显示 MoPubInterstitial ad
到activities
.
当我的设备在线/连接互联网时。然后
adListener
正常工作。这在设备离线时不起作用。
情况:如果ad
not loaded
或failed
然后我想用Intent
那里移动下一步activity
。但这MoPubAdListener
在我离线时不起作用。
插页mInterstitial.load()
式onCreate
方法
当用户按下后退按钮时,插页式广告会调用
@Override
public void onBackPressed() {
try {
customProgressDialogForAd.show(getSupportFragmentManager(),"before interstitial");
funInterstitialLoadShow();
} catch (Exception e){
QuestionActivity.super.onBackPressed();
}
//super.onBackPressed();
}
插播调用功能
private void funInterstitialLoadShow(){
mInterstitial.setInterstitialAdListener(new MoPubInterstitial.InterstitialAdListener() {
@Override
public void onInterstitialLoaded(MoPubInterstitial moPubInterstitial) {
Toast.makeText(QuestionActivity.this, "adloaded", Toast.LENGTH_SHORT).show();
mInterstitial.show();
customProgressDialogForAd.dismiss();
}
@Override
public void onInterstitialFailed(MoPubInterstitial moPubInterstitial, MoPubErrorCode moPubErrorCode) {
customProgressDialogForAd.dismiss();
QuestionActivity.super.onBackPressed();
// PROBLEM HERE: THIS fun now work when Device is OFFLINE(NO INTERNET);
}
@Override
public void onInterstitialShown(MoPubInterstitial moPubInterstitial) {
}
@Override
public void onInterstitialClicked(MoPubInterstitial moPubInterstitial) {
}
@Override
public void onInterstitialDismissed(MoPubInterstitial moPubInterstitial) {
customProgressDialogForAd.dismiss();
QuestionActivity.super.onBackPressed();
}
});
}
问题:onInterstitialFailed
当设备未连接互联网时无法工作。[另一方面,如果设备中的互联网已打开,则 sdk 可以正常工作,例如,如果我们关闭广告,则可以正常 onInterstitialDismissed
工作]
任何解决方案:请