AdManagerInterstitialAd

abstract class AdManagerInterstitialAd : InterstitialAd


यह पूरे पेज पर विज्ञापन दिखाने की सुविधा होती है, जो नैचुरल ट्रांज़िशन पॉइंट पर दिखती है. जैसे, पेज बदलना, ऐप्लिकेशन लॉन्च करना या Google Ad Manager पब्लिशर के लिए गेम का लेवल लोड होना. अचानक दिखने वाले (इंटरस्टीशियल) विज्ञापन में, 'बंद करें' बटन का इस्तेमाल किया जाता है, जिससे उपयोगकर्ता को विज्ञापन दिखने बंद हो जाते हैं.

कोड का नमूना:

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");
    }
}

खास जानकारी

सार्वजनिक कंस्ट्रक्टर

सार्वजनिक फ़ंक्शन

abstract AppEventListener?

इस AdManagerInterstitialAd के लिए AppEventListener दिखाता है.

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

AdManagerInterstitialAd को लोड करता है.

abstract Unit

यह कुकी, इस AdManagerInterstitialAd के लिए AppEventListener सेट करती है.

इनहेरिट किए गए फ़ंक्शन

com.google.android.gms.ads.interstitial.InterstitialAd से
abstract String

यह विज्ञापन यूनिट आईडी दिखाता है.

abstract FullScreenContentCallback?

इस InterstitialAd के लिए FullScreenContentCallback मिलता है.

abstract OnPaidEventListener?

इस InterstitialAd के लिए OnPaidEventListener मिलता है.

abstract Long

इस InterstitialAd के लिए प्लेसमेंट आईडी दिखाता है.

abstract ResponseInfo

लोड किए गए विज्ञापन के लिए ResponseInfo ऑब्जेक्ट दिखाता है.

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

इस फ़ंक्शन का इस्तेमाल बंद कर दिया गया है.

इसके बजाय, isAdAvailable का इस्तेमाल करें.

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

InterstitialAd को लोड करता है.

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

इस फ़ंक्शन का इस्तेमाल बंद कर दिया गया है.

इसके बजाय, pollAd का इस्तेमाल करें.

abstract Unit
setFullScreenContentCallback(
    fullScreenContentCallback: FullScreenContentCallback?
)

यह कुकी, एक कॉलबैक रजिस्टर करती है. इसे तब शुरू किया जाता है, जब विज्ञापन, फ़ुल स्क्रीन कॉन्टेंट दिखाते हैं और उसे खारिज करते हैं.

abstract Unit
setImmersiveMode(immersiveModeEnabled: Boolean)

यह फ़्लैग सेट करता है. इससे यह कंट्रोल किया जाता है कि यह इंटरस्टीशियल ऑब्जेक्ट, इमर्सिव मोड में दिखेगा या नहीं.

abstract Unit

यह एक कॉलबैक रजिस्टर करता है. इसे तब शुरू किया जाता है, जब यह अनुमान लगाया जाता है कि इस विज्ञापन से कमाई हुई है.

abstract Unit
setPlacementId(placementId: Long)

यह इंटरस्टीशियल विज्ञापन के लिए प्लेसमेंट आईडी सेट करता है.

abstract Unit
show(activity: Activity)

इंटरस्टीशियल विज्ञापन दिखाता है.

सार्वजनिक कंस्ट्रक्टर

AdManagerInterstitialAd

AdManagerInterstitialAd()

सार्वजनिक फ़ंक्शन

getAppEventListener

abstract fun getAppEventListener(): AppEventListener?

इस AdManagerInterstitialAd के लिए AppEventListener दिखाता है.

लोड

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

AdManagerInterstitialAd को लोड करता है.

पैरामीटर
context: Context

कॉन्टेक्स्ट.

adUnitId: String

विज्ञापन यूनिट का आईडी.

adManagerAdRequest: AdManagerAdRequest

टारगेटिंग (विज्ञापन के लिए सही दर्शक चुनना) की जानकारी के साथ विज्ञापन दिखाने का अनुरोध.

loadCallback: AdManagerInterstitialAdLoadCallback

Google Ad Manager का इंटरस्टीशियल विज्ञापन लोड होने के बाद, इस कॉलबैक को शुरू किया जाता है.

setAppEventListener

abstract fun setAppEventListener(appEventListener: AppEventListener?): Unit

यह कुकी, इस AdManagerInterstitialAd के लिए AppEventListener सेट करती है.