Giter VIP home page Giter VIP logo

firebase_admob_config's Introduction

pub package pub package pub package

Many flutter project earning with Google Admob and using firebase for analytics, This package help you can config AdMob ads with Firebase Remote Config and A/B testing on them

Features

  1. On/Off Ads
  2. Config Ads Unit Id
  3. A/B testing ads position
  4. Setup width/height of Ads for banner ads
  5. ... continue

Getting started

This package depends on:

  1. google_mobile_ads
  2. firebase_remote_config

If you don't have, please follow below tutorials to setup them

Usage

Setup firebase remote config with a key you want to using like this:

  1. Your config key: banner_ad
  2. Your config data:
{
  "enable": true,
  "ad_unit_id_android": "ca-app-pub-3940256099942544/6300978111",
  "ad_unit_id_ios": "ca-app-pub-3940256099942544/2934735716",
  "position": null,
  "distance": null,
  "width": null,
  "height": null
}
  1. Your config key: interstitial_ad
  2. Your config data:
{
  "enable": true,
  "ad_unit_id_android": "ca-app-pub-3940256099942544/1033173712",
  "ad_unit_id_ios": "ca-app-pub-3940256099942544/4411468910",
  "request_time_to_show": 10,
  "fail_time_to_stop": 3,
  "init_request_time": 0
}

like this

example config

Add your Ads widget to anywhere with a key you want integrate with:

//
// Interstitial Ads from Firebase Remote Config
final interstitialAd = AppInterstitialAd.fromKey(
  keyConfig: 'interstitial_ad',
);

// Banner Ads from Firebase Remote Config
Widget bannerAds() {
  return AppBannerAd.fromKey(configKey: 'banner_ad');
}

// InterstitialAd show button
Widget interstitialAd() {
  return TextButton(
    onPressed: () => interstitialAd.run(),
    child: const Text('InterstitialAd'),
  );
}

example ads

Setup Google Admob

Config your google admob like this tutorial

Google Admob

  1. In your project-level build.gradle file, include Google's Maven repository and Maven central repository in both your buildscript and allprojects sections:
buildscript {
    repositories {
        google()
        mavenCentral()
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}
  1. Add the dependencies for the Google Mobile Ads SDK to your module's app-level Gradle file, normally app/build.gradle:
dependencies {
    implementation 'com.google.android.gms:play-services-ads:21.0.0'
}
  1. Add your AdMob app ID (identified in the AdMob UI) to your app's AndroidManifest.xml file. To do so, add a tag with android:name="com.google.android.gms.ads.APPLICATION_ID". You can find your app ID in the AdMob UI. For android:value, insert your own AdMob app ID, surrounded by quotation marks.
<manifest>
    <application>
        <!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
        <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy" />
    </application>
</manifest>

In a real app, use your actual AdMob app ID, not the one listed above. If you're just looking to experiment with the SDK in a Hello World app, you can use the sample app ID shown above.

Note also that failure to add the tag as shown above results in a crash with the message: The Google Mobile Ads SDK was initialized incorrectly.

Setup Firebase remote config

Setup firebase remote config like this tutorials:

Flutter Config

Native Config

Additional information

Tell me if you want a support

Give me a coffee

PayPal

firebase_admob_config's People

Contributors

hautvfami avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.