adcolony 2.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 81

Flutter AdColony #

Note: Currently only Android platform is supported.

Note: AndroidX is required.

Getting Started #

1. Initialization #

Call Adcolony.init(); during app initialization.

AdColony.init(AdColonyOptions('#your_app_id', '0', this.zones));
class AdColonyOptions {
	final String id;
	final String gdpr;
	final List<String> zones;
	AdColonyOptions(this.id, this.gdpr, this.zones);
	Map<String, dynamic> toJson() =>
	{'Id': this.id, 'Gdpr': this.gdpr, 'Zones': this.zones};
}

For more information GDPR

2. Request Interstitial Ad and Rewarded Video Ad #

	AdColony.request('#ad_zone', listener);

3. Show Ad in listener #

listener(AdColonyAdListener event) {
	if (event == AdColonyAdListener.onRequestFilled)
		AdColony.show();
}

4. Show Ad Banner #

BannerView((AdColonyAdListener event) =>  print(event), BannerSizes.leaderboard, '#ad_zone'),

5. ProGuard Configuration #

# For communication with AdColony's WebView
-keepclassmembers class * { 
    @android.webkit.JavascriptInterface <methods>; 
}
# For removing warnings due to lack of Multi-Window support
-dontwarn android.app.Activity

Events #

enum AdColonyAdListener {
	onRequestFilled,
	onRequestNotFilled,
	onReward,
	onOpened,
	onClosed,
	onIAPEvent,
	onExpiring,
	onLeftApplication,
	onClicked
}

Future Work #

Implement for iOS platform.

0.0.1 #

  • Init Project

1.0.0 #

  • Upgrade SDK AdColony
  • Include Banners

2.0.0 #

  • Upgrade SDK AdColony
  • Migrate Plugin

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:adcolony/adcolony.dart';
import 'package:adcolony/banner.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final zones = [
    'vz943c1ab8c71b46c5a5',
    'vz943c1ab8c71b46c5a5',
    'vza5b6bdf6080b4a8682'
  ];
  @override
  void initState() {
    super.initState();
    AdColony.init(AdColonyOptions('app4f4659d279be4554ad', '0', this.zones));
  }

  listener(AdColonyAdListener event) {
    print(event);
    if (event == AdColonyAdListener.onRequestFilled)
      AdColony.show();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: ListView(
            children: <Widget>[
              RaisedButton(
                onPressed: () => AdColony.request(this.zones[1], listener),
                child: Text('Show Interstitial'),
              ),
              RaisedButton(
                onPressed: () => AdColony.request(this.zones[0], listener),
                child: Text('Show Interstitial Rewarded'),
              ),
              BannerView((AdColonyAdListener event) => print(event), BannerSizes.banner, this.zones[2]),
              BannerView((AdColonyAdListener event) => print(event), BannerSizes.medium, this.zones[2]),
              BannerView((AdColonyAdListener event) => print(event), BannerSizes.skyscraper, this.zones[2]),
              BannerView((AdColonyAdListener event) => print(event), BannerSizes.leaderboard, this.zones[2]),
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  adcolony: ^2.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


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

We analyzed this package on Apr 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health issues and suggestions

Document public APIs. (-0.36 points)

45 out of 46 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test