admob 0.1.2

  • README.md
  • Example
  • Installing
  • Versions
  • 76

Admob for Flutter

A GoogleAdmob plugin for Flutter. Currently supports interstitial ads in both iOS and Android.

Getting Started

Contains two methods for loading and showing interstitial ads.

The plugin's loadInterstitial method accepts an APP_ID, AD_UNIT_ID, DEVICE_ID, and TESTING. The loadInterstitial method should be called in an init method to load an ad as the app starts. After that the ads will reload themselves whenever you close the previous one..

APP_ID = The app id given to you by admob
AD_UNIT_ID = The ad unit id given to you by admob when you create an interstitial ad
DEVICE_ID: Include the device id for the purpose of testing purposes if you plan to test ads on a specific device
TESTING: A Boolean value indicating whether the ad units should be live or used for testing

The plugin's showInterstitial method accepts no variables, and as the name implies shows the ad you loaded with loadInterstitial.

View the example code included with the plugin in the example folder to see usage. The main.dart file included in the example folder shows an implementation of the plugin. It also includes a podfile example.

SUPPORT THE DEVELOPER

BTC Address: 13JN3yubwaPzyuBpj4MtKqirVfweq1b6Sc

example/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:admob/admob.dart';

void main() {
  runApp(new MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  bool _showInterstitialResponse;
  bool _loadInterstitialResponse;
  String APP_ID = "ca-app-pub-9929690287684724~2116069294";
  String INTERSTITIAL_AD_UNIT_ID = "ca-app-pub-9929690287684724/7809349294";
  String DEVICE_ID = "FF18F6CCC658F56ECA4C4623DB5082CA";
  bool TESTING = true;

  @override
  initState() {
    super.initState();
    loadInterstitialAd();
  }

  loadInterstitialAd() async {
    bool loadResponse;
    try {
      loadResponse = await Admob.loadInterstitial(APP_ID, INTERSTITIAL_AD_UNIT_ID, DEVICE_ID, TESTING);
    } on PlatformException {
      loadResponse = false;
    }
    setState(() {
      _loadInterstitialResponse = loadResponse;
    });
  }

  showInterstitialAd() async {
    bool showResponse;
    try {
      showResponse = await Admob.showInterstitial;
    } on PlatformException {
      showResponse = false;
    }
    setState(() {
      _showInterstitialResponse = showResponse;
    });
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('Plugin example app'),
      ),
      body: new Center(child:new Text("$_loadInterstitialResponse")),
      floatingActionButton: new FloatingActionButton(
        onPressed: () => showInterstitialAd(),
        child: new Icon(Icons.add),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  admob: "^0.1.2"

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


      import 'package:admob/admob.dart';
  
Version Uploaded Documentation Archive
0.1.27 Jun 9, 2017 Go to the documentation of admob 0.1.27 Download admob 0.1.27 archive
0.1.26 Jun 9, 2017 Go to the documentation of admob 0.1.26 Download admob 0.1.26 archive
0.1.25 Jun 6, 2017 Go to the documentation of admob 0.1.25 Download admob 0.1.25 archive
0.1.24 Jun 6, 2017 Go to the documentation of admob 0.1.24 Download admob 0.1.24 archive
0.1.23 Jun 2, 2017 Go to the documentation of admob 0.1.23 Download admob 0.1.23 archive
0.1.22 Jun 2, 2017 Go to the documentation of admob 0.1.22 Download admob 0.1.22 archive
0.1.21 Jun 2, 2017 Go to the documentation of admob 0.1.21 Download admob 0.1.21 archive
0.1.2 Jun 2, 2017 Go to the documentation of admob 0.1.2 Download admob 0.1.2 archive
0.1.1 Jun 2, 2017 Go to the documentation of admob 0.1.1 Download admob 0.1.1 archive
0.1.0 Jun 2, 2017 Go to the documentation of admob 0.1.0 Download admob 0.1.0 archive

Analysis

We analyzed this package on Jul 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3
  • Flutter: 0.5.4

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
72 / 100
Health:
Code health derived from static analysis. [more]
92 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
63 / 100
Overall score:
Weighted score of the above. [more]
76
Learn more about scoring.

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • Homepage is not helpful.

    Update the homepage property: create a website about the package or use the source repository URL.

  • Package is getting outdated.

    The package was released 58 weeks ago.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 hint.

    Run flutter format to format lib/admob.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
flutter 0.0.0
Transitive dependencies
collection 1.14.6 1.14.10
meta 1.1.5
sky_engine 0.0.99
typed_data 1.1.5
vector_math 2.0.6 2.0.7