Skip to content

rizziko/cordova-plugin-ironsource-ads

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IronSource Ads Cordova Plugin


Table of Contents


Install

npm install --save https://github.com/rizziko/cordova-plugin-ironsource-ads
npx cap sync

Usage

All methods support optional onSuccess and onFailure parameters

Initialization

IronSourceAds.init({
  appKey: appKey,
});

Validate Integration

Once you have finished your integration, call the following function and confirm that everything in your integration is marked as VERIFIED:

IronSourceAds.validateIntegration();

Check xcode / android studio debugger for validation output


Set Dynamic User ID

The Dynamic UserID is a parameter that can be changed throughout the session and will be received in the server-to-server ad > rewarded callbacks. This parameter helps verify AdRewarded transactions and must be set before calling ShowRV.

IronSourceAds.setDynamicUserId({ userId: "example" });

Rewarded Videos

Has Rewarded Video

IronSourceAds.hasRewardedVideo({
  onSuccess: function (available) {},
});

Show Rewarded Video

IronSourceAds.showRewardedVideo();

Rewarded Video Events

Rewarded Video Availabilty Changed

window.addEventListener("rewardedVideoAvailabilityChanged", function (event) {
  var available = event.available;
});

Rewarded Video Rewarded

window.addEventListener("rewardedVideoRewardReceived", function (event) {
  var placement = event.placement;
  var placementName = placement.placementName;
  var rewardAmount = placement.rewardAmount;
  var rewardName = placement.rewardName;
});

Rewarded Video Started

window.addEventListener("rewardedVideoStarted", function () {});

Rewarded Video Ended

window.addEventListener("rewardedVideoEnded", function () {});

Rewarded Video Opened

window.addEventListener("rewardedVideoOpened", function () {});

Rewarded Video Closed

window.addEventListener("rewardedVideoClosed", function () {});

Rewarded Video Failed

window.addEventListener("rewardedVideoFailed", function () {});

Interstitial

Has Interstitial

IronSourceAds.hasInterstitial({
  onSuccess: function (available) {},
});

Load Interstitial

_Must be called before showInterstitial

IronSourceAds.loadInterstitial();

Show Interstitial

IronSourceAds.showInterstitial();

Interstitial Events

Interstitial Loaded

window.addEventListener("interstitialLoaded", function () {});

Interstitial Shown

window.addEventListener("interstitialShown", function () {});

Interstitial Show Failed

window.addEventListener("interstitialShowFailed", function () {});

Interstitial Clicked

window.addEventListener("interstitialClicked", function () {});

Interstitial Closed

window.addEventListener("interstitialClosed", function () {});

Interstitial Will Open

window.addEventListener("interstitialClosed", function () {});

Interstitial Failed To Load

window.addEventListener("interstitialFailedToLoad", function () {});

Offerwalls

Has Offerwall

IronSourceAds.hasOfferwall({
  onSuccess: function (available) {},
});

Show Offerwall

IronSourceAds.showOfferwall();

Offerwall Events

Offerwall Availability Changed

window.addEventListener("offerwallAvailabilityChanged", function (event) {
  var available = event.available;
});

Offerwall Shown

window.addEventListener("offerwallShown", function () {});

Offerwall Credit Recieved

window.addEventListener("offerwallCreditReceived", function (event) {
  var credits = event.credits; // The number of credits the user has earned since //the last (void)didReceiveOfferwallCredits:
  var totalCredits = event.totalCredits; //The total number of credits ever earned by the user
});

Offerwall Credit Failed

window.addEventListener("offerwallCreditFailed", function () {});

Offerwall Closed

window.addEventListener("offerwallClosed", function () {});

Offerwall Show Failed

window.addEventListener("offerwallShowFailed", function () {});

Adding Additional SDKS

By default, this plugin does not contain other ad providers sdks

Android

Follow the integration guides here

Edit src/android/ironsourceads.gradle from this plugin and add the mediation adapters you need

Example

cdvPluginPostBuildExtras.add({

  repositories {
    maven {
      url "https://dl.bintray.com/ironsource-mobile/android-sdk"
    }
  }

  repositories {
    maven {
      url "http://dl.bintray.com/ironsource-mobile/android-adapters"
    }
  }

  dependencies {
    compile 'com.ironsource.sdk:mediationsdk:6.7.3@jar'

    //Example
    compile 'com.ironsource.adapters:admobadapter:4.0.3@jar'
    compile 'com.ironsource.adapters:facebookadapter:4.0.2@jar'
    compile 'com.ironsource.adapters:unityadsadapter:4.0.1@jar'
  }
});

IOS

IOS requires manual downloading of Adapter & SDK Download Adapters Here and follow the integration guides

_If you have any questions, create an issue, and I'll walk you through it. _

Edit plugin.xml of this plugin

   <platform name="ios">
        <config-file target="config.xml" parent="/*">
            <feature name="IronSourceAdsPlugin">
                <param name="ios-package" value="IronSourceAdsPlugin" />
            </feature>
        </config-file>
        <header-file src="src/ios/IronSourceAdsPlugin.h" />
        <source-file src="src/ios/IronSourceAdsPlugin.m" />
        <framework src="IronSourceSDK" type="podspec" spec="~> 6.7.3.1" />

        <!-- ADD MEDIATION FRAMEWORKS HERE -->
        <!-- Example -->
        <framework src="IronSourceFacebookAdapter" type="podspec" spec="~> 4.0.2.1" />
        <framework src="IronSourceAdMobAdapter" type="podspec" spec="~> 4.0.1.1" />
        <framework src="IronSourceUnityAdsAdapter" type="podspec" spec="~> 4.0.1.2" />
        <!-- Example -->

        <framework src="Foundation.framework" />
        <framework src="AVFoundation.framework" />
        <framework src="CoreMedia.framework" />
        <framework src="CoreVideo.framework" />
        <framework src="QuartzCore.framework" />
        <framework src="SystemConfiguration.framework" />
        <framework src="CoreGraphics.framework" />
        <framework src="CFNetwork.framework" />
        <framework src="MobileCoreServices.framework" />
        <framework src="libz.dylib" />
        <framework src="StoreKit.framework" />
        <framework src="AdSupport.framework" />
        <framework src="CoreLocation.framework" />
        <framework src="CoreTelephony.framework" />
        <framework src="Security.framework" />
    </platform>

About

Cordova plugin for IronSource

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 50.2%
  • Objective-C 38.4%
  • JavaScript 11.4%