<bdo id='cbRn6'></bdo><ul id='cbRn6'></ul>

    <tfoot id='cbRn6'></tfoot>
    1. <small id='cbRn6'></small><noframes id='cbRn6'>

        <i id='cbRn6'><tr id='cbRn6'><dt id='cbRn6'><q id='cbRn6'><span id='cbRn6'><b id='cbRn6'><form id='cbRn6'><ins id='cbRn6'></ins><ul id='cbRn6'></ul><sub id='cbRn6'></sub></form><legend id='cbRn6'></legend><bdo id='cbRn6'><pre id='cbRn6'><center id='cbRn6'></center></pre></bdo></b><th id='cbRn6'></th></span></q></dt></tr></i><div id='cbRn6'><tfoot id='cbRn6'></tfoot><dl id='cbRn6'><fieldset id='cbRn6'></fieldset></dl></div>

      1. <legend id='cbRn6'><style id='cbRn6'><dir id='cbRn6'><q id='cbRn6'></q></dir></style></legend>

        在这种情况下如何正确展示插页式广告?

        How to show Interstitial ad correctly in this case?(在这种情况下如何正确展示插页式广告?)

        1. <i id='4svw2'><tr id='4svw2'><dt id='4svw2'><q id='4svw2'><span id='4svw2'><b id='4svw2'><form id='4svw2'><ins id='4svw2'></ins><ul id='4svw2'></ul><sub id='4svw2'></sub></form><legend id='4svw2'></legend><bdo id='4svw2'><pre id='4svw2'><center id='4svw2'></center></pre></bdo></b><th id='4svw2'></th></span></q></dt></tr></i><div id='4svw2'><tfoot id='4svw2'></tfoot><dl id='4svw2'><fieldset id='4svw2'></fieldset></dl></div>

          <legend id='4svw2'><style id='4svw2'><dir id='4svw2'><q id='4svw2'></q></dir></style></legend>

          • <bdo id='4svw2'></bdo><ul id='4svw2'></ul>
          • <tfoot id='4svw2'></tfoot>

                <small id='4svw2'></small><noframes id='4svw2'>

                  <tbody id='4svw2'></tbody>

                  本文介绍了在这种情况下如何正确展示插页式广告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我用 gridview 适配器创建了一个音板(所以没有机会在声音按钮上设置插页式广告)我还有一个带有三个标签的导航栏,所以我决定在第二个片段上设置插页式广告,如下所示:

                  I created a soundboard with a gridview Adapter (so no chance to set the Interstitial Ad on a sound button) I also have a navigationbar with three tabs, so I decidet to set the Interstitial ad on the second fragment like this:

                  public class SecondFragment extends Fragment {
                      private InterstitialAd mInterstitialAd;
                  
                      @Nullable
                      @Override
                      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
                          View rootView=inflater.inflate(R.layout.second_layout,container,false);
                  
                          final AdRequest adRequest = new AdRequest.Builder().build();
                          mInterstitialAd = new InterstitialAd(getActivity());
                          mInterstitialAd.setAdUnitId("MYID");
                          mInterstitialAd.loadAd(adRequest);
                          mInterstitialAd.setAdListener(new AdListener() {
                              @Override
                              public void onAdLoaded() {
                                  super.onAdLoaded();
                                  if(mInterstitialAd.isLoaded()){
                                      mInterstitialAd.show();
                                  }
                  
                              }
                  
                              @Override
                              public void onAdClosed() {
                              }
                          });
                  
                  
                          return rootView;
                      }
                  

                  但问题是广告延迟了 3 秒弹出,这就是为什么我收到了来自 AdMob 的邮件,我必须正确设置插页式广告,而不是像以前那样.

                  But then the problem was that the Ad pops up with a 3 second delay, thats why I received a mail from AdMob that I have to set the Interstitial ad correctly and not like I did before.

                  所以我的问题是,在这种情况下你会怎么做?您会在哪里设置 InterstitialAd?

                  So my question is, what would you do in this case? Where would you set the InterstitialAd?

                  这是我的应用程序,3 个完整的带有声音按钮的片段:https://gyazo.com/1ecd359b38fcfe0606bb3e74b684f16e

                  This is my App, 3 fragments full with sound buttons: https://gyazo.com/1ecd359b38fcfe0606bb3e74b684f16e

                  推荐答案

                  从您的代码中,您发出加载广告的请求,然后当您的广告被加载时,您就会显示该广告.

                  From your code you're giving request to load ad then when your ad is loaded then you show that ad.

                  加载广告总是有延迟,所以我的建议是加载您的广告之前是背景而不显示该广告.每当您只想展示广告时,请检查您的插页式广告是否已准备好展示,如果是,则展示.

                  There's always a delay in loading ads so my suggestion is load your ad previously is background and not show that ad. whenever you want to show ad only check is your interstitial is ready to show, if yes show.

                  在后台立即调用 createInterstitial(),之后当您想要显示插页式广告时,调用 showInterstitial().

                  Call createInterstitial() at once in background and after that whenever you want to show interstitial Ad, call showInterstitial().

                  public void crateInterstitial(){
                  
                      interstitialAd = new InterstitialAd(this.activity);
                      interstitialAd.setAdUnitId(AD_UNIT_ID_INTERSTITIAL);
                      interstitialAd.setAdListener(new AdListener() {
                          @Override
                          public void onAdLoaded() {
                              // not call show interstitial ad from here            
                          }
                  
                          @Override
                          public void onAdClosed() {
                                loadInterstitial(); 
                           }
                        });
                      loadInterstitial();
                  }
                  
                  public void loadInterstitial(){
                  
                       AdRequest interstitialRequest = new AdRequest.Builder().build();
                       interstitialAd.loadAd(interstitialRequest);
                  }
                  
                  public void showInterstitial(){
                       if (interstitialAd.isLoaded()) 
                            interstitialAd.show();                          
                       else 
                           loadInterstitial();                                                      
                  }
                  

                  这篇关于在这种情况下如何正确展示插页式广告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)
                  SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)
                  Android file copy(安卓文件拷贝)
                  Android how to detect Copy event of Edittext in android(Android如何在android中检测Edittext的Copy事件)
                  Android copy image from gallery folder onto SD Card alternative folder(Android将图像从图库文件夹复制到SD卡替代文件夹)
                  Is there a tool to find unused resources in an Android project?(是否有工具可以在 Android 项目中查找未使用的资源?)
                  <i id='pFY0Q'><tr id='pFY0Q'><dt id='pFY0Q'><q id='pFY0Q'><span id='pFY0Q'><b id='pFY0Q'><form id='pFY0Q'><ins id='pFY0Q'></ins><ul id='pFY0Q'></ul><sub id='pFY0Q'></sub></form><legend id='pFY0Q'></legend><bdo id='pFY0Q'><pre id='pFY0Q'><center id='pFY0Q'></center></pre></bdo></b><th id='pFY0Q'></th></span></q></dt></tr></i><div id='pFY0Q'><tfoot id='pFY0Q'></tfoot><dl id='pFY0Q'><fieldset id='pFY0Q'></fieldset></dl></div>

                  <legend id='pFY0Q'><style id='pFY0Q'><dir id='pFY0Q'><q id='pFY0Q'></q></dir></style></legend>
                    <tbody id='pFY0Q'></tbody>
                  • <bdo id='pFY0Q'></bdo><ul id='pFY0Q'></ul>

                    <small id='pFY0Q'></small><noframes id='pFY0Q'>

                    1. <tfoot id='pFY0Q'></tfoot>