我正在尝试执行Banner& MoPub上的全屏广告,但我收到了这两个错误。
谢谢。
错误1:广告单元已禁用刷新功能(此处为设备ID)
错误2:Activityname泄露了最初在此处注册的IntentReceiver com.mopub.mobileads.MoPubView$1@a72e13a。你是否错过了对unregisterReceiver()的调用?
我正在执行它。
mInterstitial_recent = new MoPubInterstitial(MainActivity.this, getString(R.string.Recent_Matches_Interstitial));
mInterstitial_recent.load();
mInterstitial_recent.setInterstitialAdListener(new MoPubInterstitial.InterstitialAdListener() {
@Override
public void onInterstitialLoaded(MoPubInterstitial interstitial) {
if (mInterstitial_recent.isReady()) {
mInterstitial_recent.show();
}
}
@Override
public void onInterstitialFailed(MoPubInterstitial interstitial, MoPubErrorCode errorCode) {
startActivity(new Intent(MainActivity.this, Recent_Matches.class));
}
@Override
public void onInterstitialShown(MoPubInterstitial interstitial) {
}
@Override
public void onInterstitialClicked(MoPubInterstitial interstitial) {
}
@Override
public void onInterstitialDismissed(MoPubInterstitial interstitial) {
startActivity(new Intent(MainActivity.this, Recent_Matches.class));
}
});
答案 0 :(得分:1)
对于错误1 ,请确保您的广告单元在MoPub服务器端用户界面中为其添加了刷新率。
导航至应用> YOUR_APP_NAME> YOUR_AD_UNIT>修改广告单元
在修改广告单元表单中,您会看到可以更新和保存的“刷新间隔”字段。
对于错误2 ,请确保您在活动的OnDestroy()中销毁MoPub广告视图。下面的示例代码 -
@Override
protected void onDestroy() {
if ( mMoPubView != null ){
mMoPubView.destroy();
}
if ( mInterstitial != null ){
mInterstitial.destroy();
}
super.onDestroy();
}
答案 1 :(得分:0)
确保首先启动sdk
SdkConfiguration sdkConfiguration = new SdkConfiguration.Builder("MOPUB_ID")
.withLogLevel(MoPubLog.LogLevel.DEBUG)
.withLegitimateInterestAllowed(false)
.build();
MoPub.initializeSdk(this, sdkConfiguration, new SdkInitializationListener() {
@Override
public void onInitializationFinished() {
Log.d("Mopub", "SDK initialized");
}
});