unity_ads_plugin 0.2.1
unity_ads_plugin: ^0.2.1 copied to clipboard

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

unity_ads_plugin #

Pub

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

Getting Started #

1. Initialization: #

    UnityAds.init(
      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:

ModeDescription
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

UnityAds.showVideoAd(
  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:

StateDescription
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.

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

Possible unity banner ad state:

StateDescription
loadedBanner is loaded.
clickedBanner is clicked.
errorError during loading banner.
13
likes
120
pub points
81%
popularity

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

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

pavel.zaichyk@gmail.com

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on unity_ads_plugin