我做的游戏就像铁裤一样,游戏结束后,我正试着在广告间投放广告。
但间隙广告总是在比赛中间出现。我想这对用户来说会很烦人。我担心谷歌是否会禁止我的admob账户。
间隙广告只显示在5倍的游戏结束后。
我只有一个屏幕MainGameView.java
这是游戏结束后显示admob间隙广告的代码
间隙ads的初始化方法
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initialiseAccelerometer();
// Create the interstitial
interstitial = new InterstitialAd(this, getResources().getString(R.string.InterstitialAd_unit_id));
}
public void openAd() {
runOnUiThread(new Runnable() {
public void run() {
// Create ad request
AdRequest adRequest = new AdRequest();
// Begin loading your interstitial
interstitial.loadAd(adRequest);
// Set Ad Listener to use the callbacks below
interstitial.setAdListener(new AdListener() {
@Override
public void onReceiveAd(Ad arg0) {
if (interstitial.isReady()) {
interstitial.show();
}
}
@Override
public void onPresentScreen(Ad arg0) {
}
@Override
public void onLeaveApplication(Ad arg0) {
}
@Override
public void onFailedToReceiveAd(Ad arg0, ErrorCode arg1) {
}
@Override
public void onDismissScreen(Ad arg0) {
}
});
}
});
}当游戏结束时,我调用openAd()方法
public synchronized void GameOver() {
if (adounter >= this.getResources().getInteger(R.integer.add_shows_every_X_gameovers)) {
openAd();
adounter = 0;
}
adounter++;
}非常感谢,很抱歉我的英语很差。
发布于 2014-03-05 03:41:00
你的问题是,你一收到填字符d就会显示出来(用AdListener#onReceiveAd表示)。不要这样做。它提供了糟糕的用户体验,并将确保您得到低收视率。
相反,在你的应用程序中自然中断时显示你的添加。
发布于 2015-09-04 09:34:48
相反,在你的应用程序中自然中断时显示你的添加。
确切地说,更准确地说,如果您在onCreate - in GameOver call中请求广告,那将是很好的用户体验:
if (interstitial.isReady()) {
interstitial.show();
}https://stackoverflow.com/questions/22174053
复制相似问题