পুরস্কৃত ইন্টারস্টিশিয়াল বিজ্ঞাপন

Rewarded interstitial is a type of incentivized ad format that lets you offer rewards for ads that appear automatically during natural app transitions. Unlike rewarded ads, users aren't required to opt-in to view a rewarded interstitial. This guide shows how to integrate rewarded interstitial ads from Ad Manager into a Flutter app.

পূর্বশর্ত

  • ফ্লাটার প্লাগইন ১.১.০ বা তার বেশি।
  • শুরু করুন সম্পূর্ণ করুন। আপনার Flutter অ্যাপে ইতিমধ্যেই Google Mobile Ads Flutter প্লাগইন আমদানি করা উচিত।

সর্বদা পরীক্ষামূলক বিজ্ঞাপন দিয়ে পরীক্ষা করুন

আপনার অ্যাপ তৈরি এবং পরীক্ষা করার সময়, লাইভ, প্রোডাকশন বিজ্ঞাপনের পরিবর্তে পরীক্ষামূলক বিজ্ঞাপন ব্যবহার করুন। এটি না করলে আপনার অ্যাকাউন্ট সাসপেন্ড হতে পারে।

পরীক্ষামূলক বিজ্ঞাপন লোড করার সবচেয়ে সহজ উপায় হল পুরস্কৃত ইন্টারস্টিশিয়াল বিজ্ঞাপনের জন্য আমাদের ডেডিকেটেড পরীক্ষামূলক বিজ্ঞাপন ইউনিট আইডি ব্যবহার করা:

  • /21775744923/example/rewarded-interstitial

The test ad units are configured to return test ads for every request, and you're free to use them in your own apps while coding, testing, and debugging. Just make sure you replace them with your own ad unit IDs before publishing your app.

একটি বিজ্ঞাপন লোড করুন

নিম্নলিখিত উদাহরণটি একটি পুরস্কৃত ইন্টারস্টিশিয়াল বিজ্ঞাপন লোড করে:

RewardedInterstitialAd.load(
  adUnitId: "_adUnitId",
  request: const AdManagerAdRequest(),
  rewardedInterstitialAdLoadCallback: RewardedInterstitialAdLoadCallback(
    onAdLoaded: (RewardedInterstitialAd ad) {
      // Called when an ad is successfully received.
      debugPrint('Ad was loaded.');
      // Keep a reference to the ad so you can show it later.
      _rewardedInterstitialAd = ad;
    },
    onAdFailedToLoad: (LoadAdError error) {
      // Called when an ad request failed.
      debugPrint('Ad failed to load with error: $error');
    },
  ),
);

_adUnitId আপনার নিজস্ব বিজ্ঞাপন ইউনিট আইডি দিয়ে প্রতিস্থাপন করুন।

পুরস্কৃত ইন্টারস্টিশিয়াল বিজ্ঞাপন ইভেন্ট

Through the use of FullScreenContentCallback , you can listen for lifecycle events, such as when the ad is shown or dismissed. Set RewardedInterstitialAd.fullScreenContentCallback before showing the ad to receive notifications for these events. This example implements each method and logs a message to the console:

ad.fullScreenContentCallback = FullScreenContentCallback(
  onAdShowedFullScreenContent: (ad) {
    // Called when the ad showed the full screen content.
    debugPrint('Ad showed full screen content.');
  },
  onAdFailedToShowFullScreenContent: (ad, err) {
    // Called when the ad failed to show full screen content.
    debugPrint('Ad failed to show full screen content with error: $err');
    // Dispose the ad here to free resources.
    ad.dispose();
  },
  onAdDismissedFullScreenContent: (ad) {
    // Called when the ad dismissed full screen content.
    debugPrint('Ad was dismissed.');
    // Dispose the ad here to free resources.
    ad.dispose();
  },
  onAdImpression: (ad) {
    // Called when an impression occurs on the ad.
    debugPrint('Ad recorded an impression.');
  },
  onAdClicked: (ad) {
    // Called when a click is recorded for an ad.
    debugPrint('Ad was clicked.');
  },
);

প্রদর্শন বিজ্ঞাপন

একটি RewardedInterstitialAd সমস্ত অ্যাপ কন্টেন্টের উপরে একটি ওভারলে হিসেবে প্রদর্শিত হয় এবং স্ট্যাটিকভাবে স্থাপন করা হয়; তাই, এটি Flutter উইজেট ট্রিতে যোগ করা যায় না। আপনি show() কল করে বিজ্ঞাপনটি কখন দেখানো হবে তা বেছে নিতে পারেন। RewardedInterstitialAd.show() একটি OnUserEarnedRewardCallback নেয়, যা ব্যবহারকারী যখন পুরষ্কার অর্জন করে তখন আহ্বান করা হয়। এটি বাস্তবায়ন করতে ভুলবেন না এবং বিজ্ঞাপন দেখার জন্য ব্যবহারকারীকে পুরস্কৃত করতে ভুলবেন না।

_rewardedInterstitialAd?.show(
  onUserEarnedReward: (AdWithoutView view, RewardItem rewardItem) {
    debugPrint('Reward amount: ${rewardItem.amount}');
  },
);

Once show() is called, an Ad displayed this way can't be removed programmatically and requires user input. A RewardedInterstitialAd can only be shown once. Subsequent calls to show will trigger onAdFailedToShowFullScreenContent .

An ad must be disposed when access to it is no longer needed. The best practice for when to call dispose() is in the FullScreenContentCallback.onAdDismissedFullScreenContent and FullScreenContentCallback.onAdFailedToShowFullScreenContent callbacks.

[ঐচ্ছিক] সার্ভার-সাইড যাচাইকরণ (SSV) কলব্যাক যাচাই করুন

সার্ভার-সাইড যাচাইকরণ কলব্যাকে অতিরিক্ত ডেটার প্রয়োজন হয় এমন অ্যাপগুলিকে পুরস্কৃত বিজ্ঞাপনের কাস্টম ডেটা বৈশিষ্ট্য ব্যবহার করা উচিত। পুরস্কৃত বিজ্ঞাপনের বস্তুতে সেট করা যেকোনো স্ট্রিং মান SSV কলব্যাকের custom_data কোয়েরি প্যারামিটারে পাস করা হয়। যদি কোনও কাস্টম ডেটা মান সেট না করা থাকে, তাহলে custom_data কোয়েরি প্যারামিটার মান SSV কলব্যাকে উপস্থিত থাকবে না।

পুরস্কৃত ইন্টারস্টিশিয়াল বিজ্ঞাপন লোড হওয়ার পরে SSV বিকল্পগুলি কীভাবে সেট করতে হয় তা নিম্নলিখিত কোড নমুনাটি দেখায়:

RewardedInterstitialAd.load(
  adUnitId: "_adUnitId",
  request: AdManagerAdRequest(),
  rewardedInterstitialAdLoadCallback: RewardedInterstitialAdLoadCallback(
    onAdLoaded: (ad) {
      ServerSideVerificationOptions _options =
          ServerSideVerificationOptions(
            customData: 'SAMPLE_CUSTOM_DATA_STRING',
          );
      ad.setServerSideOptions(_options);
      _rewardedInterstitialAd = ad;
    },
    onAdFailedToLoad: (error) {},
  ),
);

SAMPLE_CUSTOM_DATA_STRING আপনার কাস্টম ডেটা দিয়ে প্রতিস্থাপন করুন।