2016-07-16 71 views
1

我已經在谷歌播放器中發佈了一個應用程序,並在其中放置了廣告,前幾天我從Google Admob收到以下電子郵件。在ViewPager中放置AdMob插頁式廣告的位置

我們提醒您,您的應用目前違反了AdMob計劃政策。重要的是,這需要您採取行動以確保廣告投放不中斷。

佈局誘發意外點擊 - 插頁式廣告:請對您需要採取的行動的更多信息請閱讀下文 發佈商不得鼓勵用戶點擊AdMob插頁式廣告以任何方式。這包括可能會導致意外點擊的任何實施方式,例如以阻止查看應用的核心內容或放置插頁式廣告的方式放置插頁式廣告,從而干擾導航或與應用的核心內容和功能進行交互。

請檢查您實現插頁式廣告,並留意不符合標準的實現以下常見的例子:

出現的應用打開或應用程序關閉後前

的插頁式廣告。 用戶關閉另一個插頁式廣告後觸發的插頁式廣告。 用戶在查看應用內容時意外加載非頁內廣告。請記住只在內容頁面之間投放插頁式廣告。 每個用戶點擊後都會觸發的插頁式廣告。 在遊戲或重度用戶互動期間出現的插頁式廣告。

下面是我的MainActivity。我需要幫助將廣告放置在適當區域

public class MainActivity extends Activity { 
    private InterstitialAd interstitial;  
// static int p; 

    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 
     ExtendedViewPager mViewPager = (ExtendedViewPager) findViewById(R.id.view_pager); 
     mViewPager.setAdapter(new TouchImageAdapter()); 


     mViewPager.setCurrentItem(5); 
    // Prepare the Interstitial Ad 

     interstitial = new InterstitialAd(MainActivity.this); 
     // Insert the Ad Unit ID 
     interstitial.setAdUnitId("xxxxxxxxxxxxxxxxxxxxxxxx"); 

      //Locate the Banner Ad in activity_main.xml 
      AdView adView = (AdView) this.findViewById(R.id.adView); 

      // Request for Ads 
      AdRequest adRequest = new AdRequest.Builder() 

      // Add a test device to show Test Ads 
      .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) 
      .addTestDevice("") 
        .build(); 

      // Load ads into Banner Ads 
      adView.loadAd(adRequest); 

      // Load ads into Interstitial Ads 
      interstitial.loadAd(adRequest); 

      // Prepare an Interstitial Ad Listener 
      interstitial.setAdListener(new AdListener() { 
       public void onAdLoaded() { 
        // Call displayInterstitial() function 
        displayInterstitial(); 
       } 
      }); 
     } 
     public void displayInterstitial() { 
      // If Ads are loaded, show Interstitial else show nothing. 
      if (interstitial.isLoaded()) { 
       interstitial.show(); 
      } 
     } 

    class TouchImageAdapter extends PagerAdapter { 

     private int[] images = { R.drawable.file_page05,R.drawable.file_page04,R.drawable.file_page03,R.drawable.file_page02,R.drawable.file_page01}; 

     @Override 
     public int getCount() { 
      return images.length; 
     } 

     @Override 
     public View instantiateItem(ViewGroup container, int position) { 
      TouchImageView img = new TouchImageView(container.getContext()); 
      img.setImageResource(images[position]); 

      container.addView(img, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); 
      return img; 
     } 

     @Override 
     public void destroyItem(ViewGroup container, int position, Object object) { 
      container.removeView((View) object); 
     } 

     @Override 
     public boolean isViewFromObject(View view, Object object) { 
      return view == object; 
     } 



    } 


} 

回答

1

製作廣告需要一些時間。您在顯示viewpager後顯示廣告。這將導致用戶通過viewpager進行導航並突然加載廣告的情況。這違反了廣告政策。

在加載viewpager之前,您需要檢查是否加載了廣告。如果廣告已加載,然後展示廣告並關閉廣告,則顯示viewpager。否則直接顯示viewpager。

我通常會在啓動器活動中加載廣告並在需要時顯示。

相關問題