Android | iOS |
---|---|
✅ | ✅ |
Follow the easy and fast 4 steps to use the package.
dependencies:
simple_ads_manager: ^0.0.2
- Create a json file in the assets folder (download json file)
- Add
<meta-data>
to theAndroidManifest.xml
file
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="REPLACE_WITH_YOUR_APP_ID"/>
- Add
GADApplicationIdentifier
to theInfo.plist
file for IOS
<key>GADApplicationIdentifier</key>
<string>REPLACE_WITH_YOUR_APP_ID</string>
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await SimpleAdsManager.instance.setAdUnits("ads.json");
await SimpleAdsManager.instance.init(appOpen: true, interstitial: true, rewarded: true);
runApp(const MyApp());
}
//show banner
SimpleAdsManager.instance.showBanner()
//show interstitial
SimpleAdsManager.instance.showInterstitialAd(context, () => {})
//show rewarded
SimpleAdsManager.instance.showRewardedAd(context, (reward) => {});
// show app open
SimpleAdsManager.instance.showAppOpenAd(context, () => {});
// show app open on app resume
SimpleAdsManager.instance.enableAutoAppOpenAdFeature(context);