gpt4 book ai didi

android - 插页式 Admob 不起作用 : AFMA_ReceiveMessage is not defined

转载 作者:行者123 更新时间:2023-11-29 15:09:02 24 4
gpt4 key购买 nike

我有两种广告:横幅广告和插页式广告。第一个效果很好,但是当我想在关闭我的应用程序之前按下后退按钮(但我们不关心按钮)时显示插页式广告。但是我的插页式广告不起作用,我的应用程序正在关闭并在日志中显示此错误:

E/Ads(20984): JS: Uncaught ReferenceError: AFMA_ReceiveMessage is not defined (:1)

我不知道这个错误是什么意思。我浏览了互联网,它可能来 self 的互联网连接。我的无线网络?或者它也可能来自 Admob?

我应该去其他连接更好的地区试试吗?

谢谢你帮助我。

最佳答案

我的代码用于添加 InterstitialAdd:

public static void addInterstitialAd(final Activity context, final int id) {
final InterstitialAd interstitial = new InterstitialAd(context);
interstitial.setAdUnitId(context.getString(id));
interstitial.loadAd(new AdRequest.Builder().build());
interstitial.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
// Call displayInterstitial() function
if (interstitial.isLoaded()) {
interstitial.show();
}
}
});
}

如果不行可以试试,请另开新帖:

 new Thread(new Runnable() {
public void run() {
final InterstitialAd interstitial = new InterstitialAd(context);
interstitial.setAdUnitId(context.getString(id));
interstitial.loadAd(new AdRequest.Builder().build());
interstitial.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
// Call displayInterstitial() function
if (interstitial.isLoaded()) {
runOnUiThread(new Runnable() {
public void run() {
interstitial.show();
}
});
}
}
});
}
}).start();

如果你想点击返回 -> Admod-> 关闭 admod -> apclose:

@Override
public void onBackPressed() {
final InterstitialAd interstitial = new InterstitialAd(getApplicationContext());
interstitial.setAdUnitId(getApplicationContext().getString(id));
interstitial.loadAd(new AdRequest.Builder().build());
interstitial.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
// Call displayInterstitial() function
if (interstitial.isLoaded()) {
interstitial.show();
}
}
@Override
public void onAdClosed(){
finish();
}
@Override
public void onAdFailedToLoad(int errorCode){
//you can implement continue load or finish
}

});
}

关于android - 插页式 Admob 不起作用 : AFMA_ReceiveMessage is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33906862/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com