Popular questions for this item

Interstitial ads are not displaying. How Can I fix it?

In fact they are showing, but not the first time you call for them. So they are skipping the first round. To fix it, open maingame.java and replace line 71-122, which is these 2 functions:

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        //setDebugMode(true);
        //initialiseAccelerometer();

        if (getResources().getString(R.string.InterstitialAd_unit_id).length() > 0) {
            // Create the interstitial
            interstitial = new InterstitialAd(this);
            interstitial.setAdUnitId(getResources().getString(R.string.InterstitialAd_unit_id));
        }
        //initialise banner ad
        this.BANNER_AD_UNIT_ID = getResources().getString(R.string.BannerAd_unit_id);
        showBanner();

        //restart time
        time.set(0, 0, 0, 0, 0, 0);

        //load local scores
        BestScore = scoreManager.load_localscore();
        if (BestScore.Details == null)
            saveBestScore();
    }

    public void openAd() {
        if (getResources().getString(R.string.InterstitialAd_unit_id).length() > 0) {
            runOnUiThread(new Runnable() {
                public void run() {
                    System.out.println("show ad");
                    // Create ad request.
                    AdRequest adRequest = new AdRequest.Builder()
                            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
                            .addTestDevice("275D94C2B5B93B3C4014933E75F92565")///nexus7//////testing
                            .addTestDevice("91608B19766D984A3F929C31EC6AB947") /////////////////testing//////////////////remove///////////
                            .addTestDevice("6316D285813B01C56412DAF4D3D80B40") ///test htc sensesion xl
                            .addTestDevice("8C416F4CAF490509A1DA82E62168AE08")//asus transformer
                            .addTestDevice("7B4C6D080C02BA40EF746C4900BABAD7")//Galaxy S4
                            .build();

                    // Begin loading your interstitial.
                    interstitial.loadAd(adRequest);

                    if (interstitial.isLoaded()) {
                        interstitial.show();
                    }
                }
            });
        }
    }

Replace it with this:

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        //setDebugMode(true);
        //initialiseAccelerometer();

        if (getResources().getString(R.string.InterstitialAd_unit_id).length() > 0) {
            // Create the interstitial
            interstitial = new InterstitialAd(this);
            interstitial.setAdUnitId(getResources().getString(R.string.InterstitialAd_unit_id));

            // Create ad request.
            AdRequest adRequest = new AdRequest.Builder()
                    .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
                    .addTestDevice("275D94C2B5B93B3C4014933E75F92565")///nexus7//////testing
                    .addTestDevice("91608B19766D984A3F929C31EC6AB947") /////////////////testing//////////////////remove///////////
                    .addTestDevice("6316D285813B01C56412DAF4D3D80B40") ///test htc sensesion xl
                    .addTestDevice("8C416F4CAF490509A1DA82E62168AE08")//asus transformer
                    .addTestDevice("7B4C6D080C02BA40EF746C4900BABAD7")//Galaxy S4
                    .build();

            // Begin loading your interstitial.
            interstitial.loadAd(adRequest);
        }
        //initialise banner ad
        this.BANNER_AD_UNIT_ID = getResources().getString(R.string.BannerAd_unit_id);
        showBanner();

        //restart time
        time.set(0, 0, 0, 0, 0, 0);

        //load local scores
        BestScore = scoreManager.load_localscore();
        if (BestScore.Details == null)
            saveBestScore();
    }

    public void openAd() {
        if (getResources().getString(R.string.InterstitialAd_unit_id).length() > 0) {
            runOnUiThread(new Runnable() {
                public void run() {

                    if (interstitial.isLoaded()) {
                        interstitial.show();
                    }
                }
            });
        }
    }

I just moved the loadAd() in the create method to pre load the ad.

In strings.xml I have: <integer name=”ad_shows_every_X_gameovers”>1</integer> but the interstatial ad still shows up every 2 gameovers

Open maingame.java and in line 449 change all your gameover() function with this:

    public synchronized void GameOver() {
        saveBestScore();
        ad_counter++;
        if (ad_counter >= getResources().getInteger(R.integer.ad_shows_every_X_gameovers)) {
            openAd();
            ad_counter = 0;
        }
        state = GAMEOVER;
    }

basically I just moved ad_counter++; up in the code

The banner ad is not displaying well.

I knew about the banner ad problem. The thing is that the app is designed for interstitial ads (you make more money from them I think because more people click them). In the last update, I added the banner ads, in the code, because I had the code ready and just added it. That’s why I didn’t mention it in the item details.

A good solution would be to move the buttons up from maingame.java line 405:

//home button
        btn_Home = new Button(new Sprite(BitmapFactory.decodeResource(getResources(), R.drawable.home), ScreenWidth() * 0.15f), 0, 0, this, false);
        btn_Home.x = ScreenWidth() - btn_Home.getWidth() * 1.2f;
        btn_Home.y = ScreenHeight() - btn_Home.getHeight() * 1.2f;//increase

        //replay button
        btn_Replay = new Button(new Sprite(BitmapFactory.decodeResource(getResources(), R.drawable.replay), ScreenWidth() * 0.13f), 0, 0, this, false);
        btn_Replay.x = btn_Replay.getWidth() * 0.2f;
        btn_Replay.y = ScreenHeight() - btn_Replay.getHeight() * 1.2f;//increase

Just increase the 1.2f. It’s a bit of a compromise because the buttons won’t look so good if they where to be moved up.

by
by
by
by
by
by