AdManagerInterstitialAd

abstract class AdManagerInterstitialAd : InterstitialAd


Google Ad Manager yayıncıları için sayfa değişimi, uygulama başlatma veya oyun seviyesi yüklenmesi gibi doğal geçiş noktalarındaki tam sayfa reklam deneyimidir. Geçiş reklamları, reklamı kullanıcının deneyiminden kaldıran bir kapat düğmesi kullanır.

Örnek kod:

public class MyActivity extends Activity {
    private AdManagerInterstitialAd adManagerInterstitialAd;
    private Button nextLevelButton;
    private TextView textView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Create a full screen content callback.
        FullScreenContentCallback fullScreenContentCallback = new FullScreenContentCallback() {
            @Override
            public void onAdDismissedFullScreenContent() {
               adManagerInterstitialAd = null;
               // Proceed to the next level.
               goToNextLevel();
            }
        };

        // Load a Google Ad Manager interstitial ad. When a natural transition in the app occurs
        // (such as a level ending in a game), show the interstitial. In this simple example, the
        // press of a button is used instead.
        //
        // If the button is clicked before the interstitial is loaded, the user should proceed to
        // the next part of the app (in this case, the next level).
        //
        // If the interstitial is finished loading, the user will view the interstitial before
        // proceeding.
        AdManagerInterstitialAd.load(
            this,
            "myAdUnitId",
            new AdManagerAdRequest.Builder().build(),
            new AdManagerInterstitialAdLoadCallback() {
                @Override
                public void onAdLoaded(@NonNull AdManagerInterstitialAd ad) {
                    adManagerInterstitialAd = ad;
                    adManagerInterstitialAd.setFullScreenContentCallback(
                        fullScreenContentCallback);
                }

                @Override
                public void onAdFailedToLoad(@NonNull LoadAdError adError) {
                    // Code to be executed when an ad request fails.
                }
            });

        // Create the button to go to the next level.
        nextLevelButton = new Button(this);
        nextLevelButton.setText("Next Level");
        nextLevelButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                // Show the interstitial if it is ready. Otherwise, proceed to the next level
                // without ever showing it.
                if (adManagerInterstitialAd != null) {
                    adManagerInterstitialAd.show(MyActivity.this);
                } else {
                    // Proceed to the next level.
                    goToNextLevel();
                }
            }
        });

        // Add the next level button to the layout.
        LinearLayout layout = new LinearLayout(this);
        layout.setOrientation(LinearLayout.VERTICAL);
        layout.addView(nextLevelButton);

        // Create a TextView to display the current level.
        textView = new TextView(this);
        textView.setText("Level 1");
        layout.addView(textView);

        setContentView(layout);
    }

    public void goToNextLevel() {
        // Show the next level, and disable the next level button since there are no more levels.
        nextLevelButton.setEnabled(false);
        textView.setText("Level 2");
    }
}

Özet

Herkese açık oluşturucular

Herkese açık işlevler

abstract AppEventListener?

Bu AdManagerInterstitialAd için AppEventListener değerini döndürür.

java-static Unit
load(
    context: Context,
    adUnitId: String,
    adManagerAdRequest: AdManagerAdRequest,
    loadCallback: AdManagerInterstitialAdLoadCallback
)

AdManagerInterstitialAd yükler.

abstract Unit

Bu AdManagerInterstitialAd için AppEventListener ayarlar.

Devralınan işlevler

From com.google.android.gms.ads.interstitial.InterstitialAd
abstract String

Reklam birimi kimliğini döndürür.

abstract FullScreenContentCallback?

Bu InterstitialAd için FullScreenContentCallback değerini alır.

abstract OnPaidEventListener?

Bu InterstitialAd için OnPaidEventListener değerini alır.

abstract Long

Bu InterstitialAd için yerleşim kimliğini döndürür.

abstract ResponseInfo

Yüklenen reklam için ResponseInfo nesnesini döndürür.

java-static Boolean
isAdAvailable(context: Context, adUnitId: String)

Bu işlev kullanımdan kaldırılmıştır.

Bunun yerine isAdAvailable politikasını kullanın.

java-static Unit
load(
    context: Context,
    adUnitId: String,
    adRequest: AdRequest,
    loadCallback: InterstitialAdLoadCallback
)

InterstitialAd yükler.

java-static InterstitialAd?
pollAd(context: Context, adUnitId: String)

Bu işlev kullanımdan kaldırılmıştır.

Bunun yerine pollAd politikasını kullanın.

abstract Unit
setFullScreenContentCallback(
    fullScreenContentCallback: FullScreenContentCallback?
)

Reklamlar gösterildiğinde ve tam ekran içerik kapatıldığında çağrılacak bir geri çağırma kaydeder.

abstract Unit
setImmersiveMode(immersiveModeEnabled: Boolean)

Bu geçiş reklamı nesnesinin tam ekran modunda gösterilip gösterilmeyeceğini kontrol eden bir işaret ayarlar.

abstract Unit

Bu reklamın para kazandığı tahmin edildiğinde çağrılacak bir geri çağırma işlevi kaydeder.

abstract Unit
setPlacementId(placementId: Long)

Geçiş reklamı için bir yerleşim kimliği ayarlar.

abstract Unit
show(activity: Activity)

Geçiş reklamını gösterir.

Herkese açık oluşturucular

AdManagerInterstitialAd

AdManagerInterstitialAd()

Herkese açık işlevler

getAppEventListener

abstract fun getAppEventListener(): AppEventListener?

Bu AdManagerInterstitialAd için AppEventListener değerini döndürür.

load

java-static fun load(
    context: Context,
    adUnitId: String,
    adManagerAdRequest: AdManagerAdRequest,
    loadCallback: AdManagerInterstitialAdLoadCallback
): Unit

AdManagerInterstitialAd yükler.

Parametreler
context: Context

Bağlam

adUnitId: String

Reklam birimi kimliği.

adManagerAdRequest: AdManagerAdRequest

Hedefleme bilgileri içeren bir reklam isteği.

loadCallback: AdManagerInterstitialAdLoadCallback

Google Ad Manager geçiş reklamı yüklenmeyi tamamladığında çağrılacak geri çağırma.

setAppEventListener

abstract fun setAppEventListener(appEventListener: AppEventListener?): Unit

Bu AdManagerInterstitialAd için AppEventListener ayarlar.