Interstitial Admob 不起作用:AFMA_ReceiveMessage 未定义
Interstitial Admob doesn't work : AFMA_ReceiveMessage is not defined
我有两种广告:横幅广告和插页式广告。第一个效果很好,但是当我想在关闭我的应用程序之前按下后退按钮(但我们不关心按钮)时显示插页式广告。但是我的插页式广告不起作用,我的应用程序正在关闭并在日志中显示此错误:
E/Ads(20984): JS: Uncaught ReferenceError: AFMA_ReceiveMessage is not defined (:1)
我不知道这个错误是什么意思。
我浏览了互联网,它可能来自我的互联网连接。我的无线网络?
或者它也可能来自 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
}
});
}
我有两种广告:横幅广告和插页式广告。第一个效果很好,但是当我想在关闭我的应用程序之前按下后退按钮(但我们不关心按钮)时显示插页式广告。但是我的插页式广告不起作用,我的应用程序正在关闭并在日志中显示此错误:
E/Ads(20984): JS: Uncaught ReferenceError: AFMA_ReceiveMessage is not defined (:1)
我不知道这个错误是什么意思。 我浏览了互联网,它可能来自我的互联网连接。我的无线网络? 或者它也可能来自 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
}
});
}