https://github.com/anmolsethi/unity_ads_mediation
Unity Mediation is a plugin for Flutter Applications. This plugin is able to display and Unity Rewarded Ads and Interstitial Ads.
https://github.com/anmolsethi/unity_ads_mediation
unity-ads unity3d-plugin unityads
Last synced: 22 days ago
JSON representation
Unity Mediation is a plugin for Flutter Applications. This plugin is able to display and Unity Rewarded Ads and Interstitial Ads.
- Host: GitHub
- URL: https://github.com/anmolsethi/unity_ads_mediation
- Owner: AnmolSethi
- License: mit
- Created: 2021-12-23T19:30:41.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-28T06:18:40.000Z (almost 3 years ago)
- Last Synced: 2025-04-07T21:26:20.961Z (10 months ago)
- Topics: unity-ads, unity3d-plugin, unityads
- Language: Java
- Homepage: https://pub.dev/packages/unity_ads_mediation
- Size: 85.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Unity Mediation Ads
[](https://pub.dev/packages/unity_ads_mediation)
[](https://github.com/pavzay/unity_ads_mediation/blob/master/LICENSE)
[Unity Mediation Ads](https://docs.unity.com/mediation/IntroToMediation) is a plugin for Flutter Applications. This plugin is able to display and Unity Rewarded Ads and Interstitial Ads.
_Note: We are working on the other ad formats as well_
- [Getting Started](#getting-started)
- [1. Initialization](#1-initialization)
- [2. Add Adapters](#1-add-adapters)
- [3. Show Rewarded Ad](#3-show-rewarded-ad)
- [4. Show Interstitial Ad](#4-show-interstitial-ad)
## Getting Started
### 1. Initialization:
```dart
UnityAdsMediation.initialize(
gameId: 'GAME_ID',
listener: (UnityInitializationState initializationState, Map result) {
if (initializationState == UnityInitializationState.initialized) {
} else if(initializationState == UnityInitializationState.error) {
}
},
);
```
- Get your GAME_ID from Unity Dashboard.
---
### 2. Add Adapters:
1. Open the build.gradle file in your project.
2. Add the following implementations in the dependencies section of the file, ensuring the dependencies of the adapters you intend to use in your project are declared:
```c
implementation "com.unity3d.mediation:admob-adapter:0.3.0"
implementation "com.unity3d.mediation:adcolony-adapter:0.3.0"
implementation "com.unity3d.mediation:applovin-adapter:0.3.0"
implementation "com.unity3d.mediation:facebook-adapter:0.3.0"
implementation "com.unity3d.mediation:ironsource-adapter:0.3.0"
implementation "com.unity3d.mediation:vungle-adapter:0.3.0"
```
---
### 3. Show Rewarded Ad:

```dart
UnityAdsMediation.showRewardedAd(
placementId: 'REWARDED_AD_ID',
listener: (UnityAdsState adState, Map result) {
if (state == UnityAdState.rewarded) {
} else if (state == UnityAdState.error) {
}
},
);
```
### 4. Show Interstitial Ad:

```dart
UnityAdsMediation.showInterstitialAd(
placementId: 'INTERSTITIAL_AD_ID',
listener: (UnityAdsState adState, Map result) {
if (state == UnityAdState.rewarded) {
} else if (state == UnityAdState.error) {
}
},
);
```
UnityAdsState:
| State | Description |
| -------- | ----------------------------------------------------- |
| rewarded | Video played till the end. Use it to reward the user. |
| error | Some error occurred. |
| showed | Ad showed to the user |
| closed | Ad closed by the user |
| clicked | User clicked the ad. |
---
[](https://pub.dev/packages/unity_ads_mediation/score)
[](https://pub.dev/packages/unity_ads_mediation/score)
[](https://pub.dev/packages/unity_ads_mediation/score)
[](https://pub.dev/packages/unity_ads_mediation)
[](https://github.com/AnmolSethi/unity_ads_mediation)