simple_ads_manager 0.0.5 copy "simple_ads_manager: ^0.0.5" to clipboard
simple_ads_manager: ^0.0.5 copied to clipboard

An easy way to use google ads in flutter.

✅ simple_ads_manager #

Google Mobile Ads for Flutter Using AdMob #

Platform Support #

Android iOS

Usage #

Follow the easy and fast 4 steps to use the package.

Step 1: Add the package to your project #

dependencies:
  simple_ads_manager: ^0.0.2

Step 2: Ad Units #

  1. Create a json file in the assets folder (download json file)
  2. Add <meta-data> to the AndroidManifest.xml file
<meta-data
    android:name="com.google.android.gms.ads.APPLICATION_ID"
    android:value="REPLACE_WITH_YOUR_APP_ID"/>
  1. Add GADApplicationIdentifier to the Info.plist file for IOS
<key>GADApplicationIdentifier</key>
<string>REPLACE_WITH_YOUR_APP_ID</string>

Step 3: Initialize the plugin #

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());
}

Step 4: Show Ads #

//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);

//must import when using NativeTemplateStyle
import 'package:simple_ads_manager/simple_ads_manager.dart';
SimpleAdsManager.instance.showNativeAd(
nativeTemplateStyle: NativeTemplateStyle(
// Required: Choose a template.
templateType: TemplateType.medium,

// Optional: Customize the ad's style.
mainBackgroundColor: Colors.white,
cornerRadius: 10.0,
callToActionTextStyle: NativeTemplateTextStyle(
textColor: Colors.black,
backgroundColor: Colors.red,
style: NativeTemplateFontStyle.monospace,
size: 16.0),
primaryTextStyle: NativeTemplateTextStyle(
textColor: Colors.red,
backgroundColor: Colors.cyan,
style: NativeTemplateFontStyle.italic,
size: 16.0),
secondaryTextStyle: NativeTemplateTextStyle(
textColor: Colors.green,
backgroundColor: Colors.black,
style: NativeTemplateFontStyle.bold,
size: 16.0),
tertiaryTextStyle: NativeTemplateTextStyle(
textColor: Colors.brown,
backgroundColor: Colors.amber,
style: NativeTemplateFontStyle.normal,
size: 16.0))),

Author #

Eng. Zeeshan Ali #

7
likes
110
points
79
downloads

Publisher

unverified uploader

Weekly Downloads

An easy way to use google ads in flutter.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, google_mobile_ads

More

Packages that depend on simple_ads_manager