2014-10-04 88 views
1

在我的应用程序中,我放置了插页式广告全页。它在大多数手机上都能正常工作,但是当我检查我的朋友Galaxy Note 1时,插页式广告正在重复播放。我不知道为什么它只发生在一个手机..我检查了三个以上的其他手机包括三星Galaxy S2,S3等......但在这些手机没有问题,我也在模拟器中测试过。 。一旦我关闭广告就没有问题了,它不会重复。问题是这个特定的手机,如果有人知道的原因,请帮助...这是内存或somethiing的问题..Android插页式广告重复

我给下面的代码。

public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     requestWindowFeature(Window.FEATURE_NO_TITLE); 
     getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 
     setContentView(R.layout.tabpmnth_xm); 

     // Create the interstitial. 
     interstitial = new InterstitialAd(this); 
     interstitial.setAdUnitId("ca-app-pub-xxxxxxxxxxxx8x/x2xxxxxxxx"); 

     // Create ad request. 
     AdRequest aadRequest = new AdRequest.Builder() 
     .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) 
     .addTestDevice("xxxxxxxxxxxxxxxxxxxx") 
     .build(); 

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


     interstitial.setAdListener(new AdListener(){ 
       public void onAdLoaded(){ 
        displayInterstitial(); 
       } 
    }); 




public void displayInterstitial() { 
     if (interstitial.isLoaded()) { 
      interstitial.show(); 
     } 
     } 
上面的链接

回答

1

对不起Jocheved迟到的重播。如果每个手机都没有发生这个问题,那么问题可能出在用户的手机设置上。只需检查是否在他/她的“设置>开发人员选项>不保留活动”中选择。如果它被选中,那么应用程序将在用户离开当前活动后立即销毁所有活动。因此,当显示插页式广告时,当前活动通常会在onPause中进行。但会被销毁,当用户关闭插页式广告并再次返回时,广告就会展示。为了避免这种情况,您可以通知用户检查是否选择了该选项。否则,您可能需要找到其他解决方案并通过编程来解决。谢谢..

-2

https://groups.google.com/forum/#!topic/google-admob-ads-sdk/i6zOe2Hy-xc

退房哪里,为什么这个问题引起你谷歌的AdMob工程师解释。不需要在onAdLoaded()中包含displayInterstitial()。要么在一段时间后显示您的插页式广告,我使用onCountdownTimer()来实现此目的。对于例如5秒后显示广告。

 new CountDownTimer(5000, 5) { 
         @Override 
         public void onTick(long millisUntilFinished) { 

         } 

         @Override 
         public void onFinish() { 
           displayInterstitial(); 
         } 
        }.start(); 
+0

谢谢库纳尔....你的帮助..让我检查 – Jocheved 2014-10-04 09:16:41