इनाम वाले इंटरस्टीशियल विज्ञापन (बीटा)

इनाम वाला इंटरस्टीशियल विज्ञापन फ़ॉर्मैट, फ़ायदा देने वाला एक विज्ञापन फ़ॉर्मैट है. इसकी मदद से, दिखने वाले विज्ञापनों के लिए इनाम ऐप्लिकेशन के नैचुरल ट्रांज़िशन के दौरान. इनाम वाले विज्ञापनों के उलट, उपयोगकर्ता इनाम वाला इंटरस्टीशियल विज्ञापन देखने के लिए, ऑप्ट-इन करना ज़रूरी है. इस गाइड में, Ad Manager के इनाम वाले इंटरस्टीशियल विज्ञापनों को इंटिग्रेट करें Flutter ऐप्लिकेशन में अपडेट करना होगा.

ज़रूरी शर्तें

  • Flutter प्लगिन 1.1.0 या इसके बाद वाला वर्शन.
  • शुरू करें चरण पूरा करें. आपका Flutter ऐप्लिकेशन में Google Mobile Ads Flutter प्लगिन पहले से मौजूद होना चाहिए आयात किया गया.

हमेशा टेस्ट विज्ञापनों से टेस्ट करें

अपने ऐप्लिकेशन बनाते और उनकी जांच करते समय पक्का करें कि आप विज्ञापनों के बजाय टेस्ट विज्ञापनों का इस्तेमाल करें लाइव, प्रोडक्शन के लिए विज्ञापन. ऐसा न करने पर, आपका खाता निलंबित किया जा सकता है.

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

  • /21775744923/example/rewarded_interstitial

टेस्ट विज्ञापन यूनिट को, हर अनुरोध के हिसाब से टेस्ट विज्ञापन दिखाने के लिए कॉन्फ़िगर किया जाता है और कोडिंग, टेस्टिंग, और डीबग करने के दौरान, इन्हें अपने ऐप्लिकेशन में इस्तेमाल किया जा सकता है. पब्लिश करने से पहले, पक्का करें कि आपने उनकी जगह अपने विज्ञापन यूनिट आईडी डाल दिए हों आपका ऐप्लिकेशन.

विज्ञापन लोड करें

यहां दिए गए उदाहरण में, इनाम वाले इंटरस्टीशियल विज्ञापन को लोड किया गया है:

class RewardedInterstitialExampleState extends State<RewardedInterstitialExample> {
  RewardedInterstitialAd? _rewardeInterstitialdAd;

  // TODO: replace this test ad unit with your own ad unit.
  final adUnitId = '/21775744923/example/rewarded_interstitial';

  /// Loads a rewarded ad.
  void loadAd() {
    RewardedInterstitialAd.loadWithAdManagerAdRequest(
        adUnitId: adUnitId,
        adManagerAdRequest: const AdManagerAdRequest(),
        adLoadCallback: RewardedInterstitialAdLoadCallback(
          // Called when an ad is successfully received.
          onAdLoaded: (ad) {
            debugPrint('$ad loaded.');
            // Keep a reference to the ad so you can show it later.
            _rewardedInterstitialAd = ad;
          },
          // Called when an ad request failed.
          onAdFailedToLoad: (LoadAdError error) {
            debugPrint('RewardedInterstitialAd failed to load: $error');
          },
        ));
  }
}

इनाम वाले इंटरस्टीशियल विज्ञापन के इवेंट

FullScreenContentCallback का इस्तेमाल करके, लाइफ़साइकल के हिसाब से सुना जा सकता है इवेंट, जैसे कि विज्ञापन कब दिखाया या खारिज किया गया. शुरू इन्हें विज्ञापन दिखाने से पहले RewardedInterstitialAd.fullScreenContentCallback इन इवेंट के लिए नोटिफ़िकेशन पाएं. इस उदाहरण में, सभी तरीके लागू किए गए हैं और कंसोल में मैसेज लॉग करता है:

class RewardedInterstitialExampleState extends State<RewardedInterstitialExample> {
  RewardedInterstitialAd? _rewardedInterstitialAd;

  // TODO: replace this test ad unit with your own ad unit.
  final adUnitId = '/21775744923/example/rewarded_interstitial';

  /// Loads a rewarded ad.
  void loadAd() {
    RewardedInterstitialAd.loadWithAdManagerAdRequest(
        adUnitId: adUnitId,
        adManagerAdRequest: const AdManagerAdRequest(),
        adLoadCallback: RewardedInterstitialAdLoadCallback(
          // Called when an ad is successfully received.
          onAdLoaded: (ad) {
            ad.fullScreenContentCallback = FullScreenContentCallback(
              // Called when the ad showed the full screen content.
              onAdShowedFullScreenContent: (ad) {},
              // Called when an impression occurs on the ad.
              onAdImpression: (ad) {},
              // Called when the ad failed to show full screen content.
              onAdFailedToShowFullScreenContent: (ad, err) {
                // Dispose the ad here to free resources.
                ad.dispose();
              },
              // Called when the ad dismissed full screen content.
              onAdDismissedFullScreenContent: (ad) {
                // Dispose the ad here to free resources.
                ad.dispose();
              },
              // Called when a click is recorded for an ad.
              onAdClicked: (ad) {});

            debugPrint('$ad loaded.');
            // Keep a reference to the ad so you can show it later.
            _rewardedInterstitialAd = ad;
          },
          // Called when an ad request failed.
          onAdFailedToLoad: (LoadAdError error) {
            debugprint('RewardedInterstitialAd failed to load: $error');
          },
        ));
  }
}

Display Network में दिखने वाला विज्ञापन

RewardedInterstitialAd को ऐप्लिकेशन के सभी कॉन्टेंट के ऊपर ओवरले के तौर पर दिखाया जाता है और उसे स्टैटिक तौर पर रखा गया हो; इसलिए, इसे Flutter विजेट ट्री में नहीं जोड़ा जा सकता. show() पर कॉल करके, विज्ञापन दिखाने की तारीख तय की जा सकती है. RewardedInterstitialAd.show() को एक OnUserEarnedRewardCallback मिलता है, जो कि यह तब शुरू किया जाता है, जब उपयोगकर्ता कोई इनाम हासिल करता है. इसे लागू करना न भूलें. साथ ही, का इस्तेमाल करते हैं.

_rewardedInterstitialAd.show(onUserEarnedReward: (AdWithoutView ad, RewardItem rewardItem) {
  // Reward the user for watching an ad.
});

show() को कॉल करने के बाद, इस तरह दिखने वाले Ad को हटाया नहीं जा सकता प्रोग्रामेटिक है और इसे उपयोगकर्ता के इनपुट की ज़रूरत होती है. RewardedInterstitialAd सिर्फ़ ये काम कर सकता है एक बार दिखेगा. बाद में दिखाए जाने वाले कॉल ट्रिगर होंगे onAdFailedToShowFullScreenContent.

जब किसी विज्ञापन की ज़रूरत न हो, तब उसे हटा देना चाहिए. सबसे सही तरीका dispose() को कब कॉल करना है, यह जानने के लिए FullScreenContentCallback.onAdDismissedFullScreenContent और FullScreenContentCallback.onAdFailedToShowFullScreenContent कॉलबैक.

हो गया! अब आपका ऐप्लिकेशन, इनाम वाले इंटरस्टीशियल विज्ञापन दिखाने के लिए तैयार है.