# poponl_ads

pop.onl ad mediation for Flutter. Rewarded and interstitial ads from the ad networks' own SDKs, in the waterfall
order set on [pop.onl](https://pop.onl). Wraps the pop.onl Android and iOS SDKs.

## Install

```bash
flutter pub add poponl_ads
```

Android, `android/gradle.properties` (the networks you turned on at pop.onl):

```properties
poponl.networks=admob,unityads,pangle
```

and in `android/settings.gradle` (or `build.gradle`) repositories: `maven { url "https://maven.pop.onl" }` plus the
network repositories listed in the pop.onl Android SDK README. AdMob also needs its app id in AndroidManifest
(`com.google.android.gms.ads.APPLICATION_ID`).

iOS, `ios/Podfile`, inside the Runner target:

```ruby
pod 'PopOnlAds/AdMob'
pod 'PopOnlAds/Pangle'
```

AdMob also needs `GADApplicationIdentifier` in Info.plist.

## Use

```dart
import 'package:poponl_ads/poponl_ads.dart';

await PopOnlAds.setConsent(true);                      // from your consent prompt
await PopOnlAds.initialize('po_app_XXXXXXXXXXXXXXXXXXXX');

if (await PopOnlAds.isRewardedReady('revive')) {
  final earned = await PopOnlAds.showRewarded('revive');
  if (earned) giveReward();
}
await PopOnlAds.showInterstitial('level_end');
```

Networks: Android has all 17; iOS has admob, unityads, pangle, liftoff, inmobi so far.
