0

1分ごとにインタースティシャル広告を表示したいのですが... どなたかサンプルコードで説明していただけないでしょうか...

ありがとうお願いします

    interstitialAds = new InterstitialAd(this, "Your_Pub_ID");
    final AdRequest adRequest = new AdRequest();
    interstitialAds.loadAd(adRequest);
    interstitialAds.setAdListener(this);
4

6 に答える 6

8

まず、これはユーザーにとって非常に悪い経験になります。私はそれに対して強くお勧めします。

しかし、本当にユーザーを怒らせたい場合は、次のようにします。

final Runnable runanble = new Runnable() {
  public void run() {
    while (true) {
      wait(60000);
      runOnUiThread(intersitial.showAd());
      interstitial.loadAd(new request());
    }
  }
};

編集: これをしないでください。これは Admob のポリシーに直接違反しており、アカウントが無効になるという連絡が Admob からありました。

于 2013-10-07T23:29:05.783 に答える
7

これはadmobのポリシーに反しており、あなたを禁止するでしょう。これはユーザーにとって非常に悪い経験になります.

編集:ポリシーへのリンク (「Repeated or recurring interstitials」セクションを参照) - https://support.google.com/admob/answer/6201362?hl=en&ref_topic=2745287

于 2014-07-19T10:12:11.197 に答える
1
place it in oncreate method

handler.postDelayed(runnable, 420000);

oncreate メソッドの後

Runnable runnable = new Runnable(){
@Override
public void run() {
// TODO Auto-generated method stub
//Your code to show add
// Create the interstitial.
// Prepare the Interstitial Ad
Interstitial = new InterstitialAd(your activity);
// Insert the Ad Unit ID
interstitial.setAdUnitId("your id ");

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

// 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();
 }
 });
 handler.postDelayed(this, 600000); // 1000 - Milliseconds
 }
 };
于 2016-09-30T07:27:19.220 に答える