This section shows the way to configure Admob and Facebook Ads.

This feature requires Firebase to be set. Please skip the steps below if you have set Firebase.

You can do these steps to configure the new App when using any service for Firebase:

  1. Using the Firebase Console, add an Android app to your project: Follow the assistant, download the generated google-services.json file, and place it inside android/app.
  2. Using the Firebase Console, add an iOS app to your project: Follow the assistant, download the generated GoogleService-Info.plist file, open ios/Runner.xcworkspace with Xcode, and within Xcode place the file inside ios/Runner.

When installing, if you get issue, please go to Common Questions or Common Issues to find the solutions.

Enable Admod and Facebook Ads

Open the lib/common/config.dart and enable the setting for Ads features. (From version 1.6.5 onwards, refer lib/common/config/advertise.dart)

const kAdConfig = {
  "enable": false,
  "type": kAdType.facebookNative,
  // ----------------- Facebook Ads  -------------- //
  "hasdedIdTestingDevice": "ef9d4a6d-15fd-4893-981b-53d87xxx",
  "bannerPlacementId": "430258564493822_4890075886xxx",
  "interstitialPlacementId": "430258564493822_489092398xxx",
  "nativePlacementId": "430258564493822_4890927386xxx",
  "nativeBannerPlacementId": "430258564493822_48909292xxx",

  // ------------------ Google Admob  -------------- //
  "androidAppId": "ca-app-pub-2101182411274198~6793xxx",
  "androidUnitBanner": "ca-app-pub-2101182411274198/405xxx",
  "androidUnitInterstitial": "ca-app-pub-xxx",
  "androidUnitReward": "ca-app-pub-2101182411274198/xxx",
  "iosAppId": "ca-app-pub-2101182411274198~xxx",
  "iosUnitBanner": "ca-app-pub-2101182411274198/xxx",
  "iosUnitInterstitial": "ca-app-pub-xxxx/x",
  "iosUnitReward": "ca-app-pub-xxxxx/xx",
  "waitingTimeToDisplayInterstitial": 10,
  "waitingTimeToDisplayReward": 10,
};
  • The Ads feature is default config for Product Detail screen as a banner Facebook widget Ads().facebookBanner() or show as Admob widget Ads.showBanner()
  • To refer to another type of banner please check the model/advertisement.dart

For more detail guide about the library please check out:

Admod

Facebook Ads