我有插页式广告的源代码,我更改了插页式MobFox,游戏运行但没有显示插页式广告
我把用于生成插页式广告的代码用来帮助我
import com.adsdk.sdk.Ad;
import com.adsdk.sdk.AdListener;
import com.adsdk.sdk.AdManager;
import com.adsdk.sdk.Gender;
import com.adsdk.sdk.banner.AdView;
...
public class MainGame extends Screen {
...
//ad
private AdManager mManager;
int ad_counter = 0;
...
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
//setDebugMode(true);
//initialiseAccelerometer();
//highscores
highscoreManager = new HighScoreManager(this, savedInstanceState, layout);
// Create the interstitial
mManager = new AdManager(this,"http://my.mobfox.com/request.php",
"fe96717d9875b9da4339ea5367eff1ec", true);
//interstitial = new InterstitialAd(this, getResources().getString(R.string.InterstitialAd_unit_id));
}
public void openAd() {
runOnUiThread(new Runnable() {
public void run() {
// Create ad request
mManager.requestAd();
}
});
}
...
public synchronized void GameOver() {
if (ad_counter >= getResources().getInteger(R.integer.add_shows_every_X_gameovers)) {
mManager.showAd();//TODO: Remove openAd(); to stop interstatial ads.
ad_counter = 0;
}
答案 0 :(得分:0)
你没有调用openEr函数。试试
import com.adsdk.sdk.Ad;
import com.adsdk.sdk.AdListener;
import com.adsdk.sdk.AdManager;
import com.adsdk.sdk.Gender;
import com.adsdk.sdk.banner.AdView;
...
public class MainGame extends Screen {
...
//ad
private AdManager mManager;
int ad_counter = 0;
...
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
//setDebugMode(true);
//initialiseAccelerometer();
//highscores
highscoreManager = new HighScoreManager(this, savedInstanceState, layout);
// Create the interstitial
mManager = new AdManager(this,"http://my.mobfox.com/request.php",
"fe96717d9875b9da4339ea5367eff1ec", true);
mManager.requestAd();
}
public synchronized void GameOver() {
if (ad_counter >= getResources().getInteger(R.integer.add_shows_every_X_gameovers)) {
mManager.showAd();//TODO: Remove openAd(); to stop interstatial ads.
ad_counter = 0;
}