【问题标题】:How I will show Interstitial ad correctly?如何正确展示插页式广告?
【发布时间】:2018-09-13 10:47:30
【问题描述】:

我有 3 个活动 A、B 和 C,我在活动 B 中展示插页式广告。但问题是,如果我立即返回活动 A,插页式广告会出现在活动 A 中。如果我立即进入下一个活动 C,插页式广告会出现在活动 C 中。但我希望插页式广告仅在活动 B 中显示。由于这个原因,Google 不接受我的应用更新。

【问题讨论】:

    标签: android interstitial


    【解决方案1】:

    试试这个方法

    InterstitialAd mInterstitial = new InterstitialAd(this);
                    mInterstitial.setAdUnitId(getResources().getString(Your_init_id));
                    AdRequest adRequest = new AdRequest.Builder().build();
                    mInterstitial.setAdListener(new AdListener() {
                        @Override
                        public void onAdLoaded() {
                            Log.d("==","onAdLoaded");
                            mInterstitial.show();
                        }
    
                        @Override
                        public void onAdFailedToLoad(int errorCode) {
                            // Code to be executed when an ad request fails.
                            Log.d("==","onAdFailedToLoad"+errorCode);
                            moveToOtherActivity();
                        }
    
    
                        @Override
                        public void onAdOpened() {
                            // Code to be executed when the ad is displayed.
                        }
    
                        @Override
                        public void onAdLeftApplication() {
                            // Code to be executed when the user has left the app.
                        }
    
                        @Override
                        public void onAdClosed() {
                            // Code to be executed when when the interstitial ad is closed.
                            Log.d("==","onAdClosed");
                            moveToOtherActivity();
                        }
                    });
                    mInterstitial.loadAd(adRequest);
    
                }
    
             private void moveToOtherActivity() {
                Intent intent;
                intent = new Intent(this,Activity_which_you_want_to_display_after_interstitial .class);
                startActivity(intent);
                finish();
            }
    

    【讨论】:

      【解决方案2】:

      有一种方法可以隐藏this post 中讨论的插页式广告

      这不会阻止它出现,它只是关闭它。

      希望对你有帮助

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-07-10
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多