Unity Ads Plugin

Pub License Pub likes Pub popularity Pub points Flutter platform GitHub popularity

Buy Me A Coffee PayPal

Unity Ads plugin for Flutter Applications. This plugin is able to display Unity Banner Ads and Unity Video Ads.

Getting Started

1. Initialization:

      gameId: 'game_id',
      listener: (state, args) => print('Init Listener: $state => $args'),

Set your Game id. For testing purposes set testMode to true.

Android only: To change ads behavior in Firebase Test Lab use firebaseTestLabMode parameter. Possible values:

disableAdsAds are not displayed in the Firebase Test Lab (by default)
showAdsInTestModeAds are displayed in test mode.
showAdsReal ads are displayed, if testMode is false.

2. Show Rewarded/Interstitial Video Ad:

Rewarded Video Ad Interstitial Video Ad

  placementId: 'video_placement_id',
  listener: (state, args) {
    if (state == UnityAdState.complete) {
      print('User watched a video. User should get a reward!');
    } else if (state == UnityAdState.skipped) {
      print('User cancel video.');

Check if the video ad is ready:

UnityAds.isReady(placementId: 'video_placement_id');

Possible unity ad state:

readyAd loaded successfully.
errorSome error occurred.
startedVideo ad started.
completeVideo played till the end. Use it to reward the user.
skippedVideo ad closed.

Server-to-server redeem callbacks

UnityAds.showVideoAd has serverId parameter.

To use server-to-server callbacks, you need to set this parameter.

Read more on unity3d.com.

3. Show Banner Ad:

Banner Ad

Place UnityBannerAd widget in your app.

  placementId: "banner_placement_id",
  listener: (state, args) {
    print('Banner Listener: $state => $args');

Possible unity banner ad state:

loadedBanner is loaded.
clickedBanner is clicked.
errorError during loading banner.

If you found this plugin helpful and would like to thank me:

Buy Me A Coffee PayPal