ironsource 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 76

ironsource #

Flutter plugin for showing IronSource ads (Android only)

Progress #

  • [x] Interstitial
  • [ ] Banner (Still experimenting)
  • [x] Offerwall
  • [x] Rewarded video

Update AndroidManifest.xml #

Manifest Permissions #

Add the following permissions to your AndroidManifest.xml file inside the manifest tag but outside the <application> tag:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Manifest Activities #

Add the following activities inside the <application> tag in your AndroidManifest:

<activity
            android:name="com.ironsource.sdk.controller.ControllerActivity"
            android:configChanges="orientation|screenSize"
            android:hardwareAccelerated="true" />
<activity
            android:name="com.ironsource.sdk.controller.InterstitialActivity"
            android:configChanges="orientation|screenSize"
            android:hardwareAccelerated="true"
            android:theme="@android:style/Theme.Translucent" />
<activity
            android:name="com.ironsource.sdk.controller.OpenUrlActivity"
            android:configChanges="orientation|screenSize"
            android:hardwareAccelerated="true"
            android:theme="@android:style/Theme.Translucent" />

add Google Play Services #

Add the following inside the

<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

please read this to add google play service

Mediatin #

follow this to add mediation sdks

Using this plugin #

see directory example

Visit IronSource website to know more

Contributing #

PR are welcomed. I don't have any java and android background, by observing (copy, paste and edit) someone else code and with my shallow basic programming I come with this plugin. so if you found an error in my code, please make an issue or a PR.

0.1.1 - 2019-8-1 #

add onResume, onPause.

0.1.0 - 2019-7-31 #

update description and example

0.0.1 - 2019-7-31 #

initial release

example/README.md

ironsource_example #

Demonstrates how to use the ironsource plugin.

Getting Started #

import it

import 'package:ironsource/ironsource.dart';

initialize it with appKey in initState and make a class that extends IronSourceListener and pass it to listener

 await IronSource.initialize(appKey: appKey, listener: this);

Interstitial #

load it before showing it using IronSource.loadInterstitial()

  void loadInterstitial() {
    IronSource.loadInterstitial();
  }

then show it when it is ready;

 void showInterstitial() async {
    if (await IronSource.isInterstitialReady()) {
      IronSource.showInterstitial();
    } else {
      print(
        "Interstial is not ready. use 'Ironsource.loadInterstial' before showing it",
      );
    }
  }

RewardedVideo and Offerwall #

check the availability of it

rewardeVideoAvailable = await IronSource.isRewardedVideoAvailable();
    offerwallAvailable = await IronSource.isOfferwallAvailable();

then show it when its available

  void showOfferwall() async {
    if (await IronSource.isOfferwallAvailable()) {
      IronSource.showOfferwall();
    } else {
      print("Offerwall not available");
    }
  }

  void showRewardedVideo() async {
    if (await IronSource.isRewardedVideoAvailable()) {
      IronSource.showRewardedVideol();
    } else {
      print("RewardedVideo not available");
    }
  }

you can use it like any other widget

Align(
    alignment: Alignment.bottomCenter,
    child: IronSourceBannerAd(
        keepAlive: true,
        listener: BannerAdListener()
    ),
)

for listener,make a class that extends IronSourceBannerListener and then pass it on listener


class BannerAdListener extends IronSourceBannerListener {
  @override
  void onBannerAdClicked() {
    // TODO: implement onBannerAdClicked
    print("onBannerAdClicked");
  }

  @override
  void onBannerAdLeftApplication() {
    // TODO: implement onBannerAdLeftApplication
    print("onBannerAdLeftApplication");
  }

  @override
  void onBannerAdLoadFailed(Map<String, dynamic> error) {
    print("onBannerAdLoadFailed");

    // TODO: implement onBannerAdLoadFailed
  }

  @override
  void onBannerAdLoaded() {
    // TODO: implement onBannerAdLoaded
    print("onBannerAdLoaded");
  }

  @override
  void onBannerAdScreenDismissed() {
    // TODO: implement onBannerAdScreenDismissed
    print("onBannerAdScreenDismisse");
  }

  @override
  void onBannerAdScreenPresented() {
    // TODO: implement onBannerAdScreenPresented
    print("onBannerAdScreenPresented");
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  ironsource: ^0.1.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:ironsource/ironsource.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
52
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
76
Learn more about scoring.

We analyzed this package on Oct 11, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-0.50 points)

117 out of 119 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.

Format lib/models.dart.

Run flutter format to format lib/models.dart.

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.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test