AdMob,横幅点击后,设备后退按钮无法正常工作

时间:2015-12-16 06:22:10

标签: android java-native-interface

我已经在我的cocos2dx安卓游戏中集成了admob,但我面临的问题是后退按钮。一旦用户点击bannar广告并尝试按下设备后退按钮方法没有被调用。

admob inegration如下: -

adView = new AdView(this);
        adView.setAdSize(AdSize.BANNER);
        adView.setAdUnitId(AD_UNIT_ID);


        AdRequest adRequest = new AdRequest.Builder()
        .build();

        adView.loadAd(adRequest);
                    adView.setBackgroundColor(Color.BLACK);
                    adView.setBackgroundColor(0);
                    addContentView(adView,adParams);
        _appActiviy = this;
        ScheduledExecutorService scheduleTaskExecutor = Executors.newScheduledThreadPool(5);


        scheduleTaskExecutor.scheduleAtFixedRate(new Runnable() {
          public void run() {
                runOnUiThread(new Runnable() {
                    public void run() {
                         AdRequest adRequest = new AdRequest.Builder().build();
                        adView.loadAd(adRequest);
                    }
                });
            }

        }, 0, 30, TimeUnit.SECONDS);

后面的按钮集成如下所示:jni: -

_appActiviy.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                new AlertDialog.Builder(_appActiviy).setMessage("Are you sure you want to quit?").
                setCancelable(true).setPositiveButton("YES", new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface arg0, int arg1) {
                        Log.d("", "ShowRateUsAndQuitDialog ");
                        ((Cocos2dxActivity)_appActiviy).finish();
                        android.os.Process.killProcess(android.os.Process.myPid());
                    }
                }).setNegativeButton("No", null).show();
                UntanglePro.showRateDialog(getContext(),null);
            }
        });

0 个答案:

没有答案