Update to the Latest ironSource Android SDK

We’re excited to introduce the ironSource SDK 6.5+, with brand new features and significant enhancements. Following the SDK release, existing integrations of earlier SDK versions are outdated. Follow this guide to upgrade from earlier SDK versions to the latest ironSource SDK. 

 Step 1. Replace Supersonic Jar with the Latest SDK

ironSource supports both Gradle dependencies and manual download mechanisms to integrate our SDK.

  • For Gradle

First, remove the following repositories and dependencies of Supersonic from your build.gradle file:

repositories {
    maven {
        url "https://dl.bintray.com/supersonic/android-sdk"
   }
}
dependencies {
    compile 'com.supersonic.sdk:mediationsdk:6.4.21@jar'
}

Replace the above files with the following:

repositories {
    maven {
        url "https://dl.bintray.com/ironsource-mobile/android-sdk"
   }
}
dependencies {
    compile 'com.ironsource.sdk:mediationsdk:6.7.0@jar'
}
  • For Manual Download
    • Download the latest ironSource SDK here.
    • Next, go to the lib folder in your project and delete the existing Supersonic jar. Add the ironSource SDK 6.X jar file to the lib folder.

Step 2. Update Manifest Activities

Replace the Supersonic Manifest Activities in your AndroidManifest.xml with the ironSource Manifest Activities.

Supersonic Manifest Activities:

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

ironSource Manifest Activities:

<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" />

Step 3. Update SDK Methods

We’ve standardized and updated all of our methods according to tech conventions, and replaced all Supersonic mentions with ironSource. In addition, you can now initialize your preferred ad units with a single init, preferably on application launch.

You’ll need to review and replace existing methods with the following:

General Methods (relevant for All Ad Units):

  • New! setUserId
    The UserID is a unique identifier for each user. You can set the userID parameter, or let us generate one for you. If you’re serving the Offerwall ad unit or server-to-server callbacks to reward your users with our rewarded ad units, you must set the UserID.  Common practice is to use the GAID (Google Advertiser ID).
    Note: You must set the UserID parameter before the init request.
    IronSource.setUserId("UserID");
  • AdvertiserId
    Call this method to retrieve the device’s unique AdvertisingID:

    IronSource.getAdvertiserId(this);
  • onPause

     protected void onPause() {        
           super.onPause();              
           IronSource.onPause(this);     
       }
  • onResume
       protected void onResume() {            
           super.onResume();                  
           IronSource.onResume(this);         
       }
  • Ad Unit Initialization
    You can initialize the SDK in two ways. We recommend the first method as it will fetch the specific ad units you define.

    • Init the specific ad units mentioned in the adUnits parameter, preferably oncreate:
      IronSource.init(this, appKey, IronSource.AD_UNIT.OFFERWALL, IronSource.AD_UNIT.INTERSTITIAL, IronSource.AD_UNIT.REWARDED_VIDEO);
    • Init the ad units you’ve configured on the ironSource platform SDK sync:
      IronSource.init(this, appKey);

Ad Unit Listener Methods:

  • Rewarded Video
    IronSource.setRewardedVideoListener(mRewardedVideoListener);
  • Interstitial
    IronSource.setInterstitialListener(mInterstitialListener);
  • Offerwall
    IronSource.setOfferwallListener(mOfferwallListener);

 

Ad Unit Methods

  • Rewarded Video
    Replace the following Supersonic Methods:

    /**
    *Call to check ad availability
    */
    mMediationAgent.isRewardedVideoAvailable();
    /**
    *Call to show a rewarded video
    */
     mMediationAgent.showRewardedVideo();
    /**
    * Call to check if a placement is capped
    */
    mMediationAgent.isRewardedVideoPlacementCapped("Your Placements");

    With the ironSource Methods:

    /**
    *Call to check ad availability
    */
    IronSource.isRewardedVideoAvailable();
    /**
    *Call to show a rewarded video
    */
    IronSource.showRewardedVideo();
    /**
    * Call to check if a placement is capped
    */
    IronSource.isRewardedVideoPlacementCapped("Your Placements");
  • Interstitial
    Replace the following Supersonic methods:

    /**
    *Call to request an interstitial ad
    */
    mMediationAgent.loadInterstitial();
    /**
    *Call to show an interstitial ad 
    */
    mMediationAgent.showInterstitial(); 
    /**
    *Call to check ad availability
    */
    mMediationAgent.isInterstitialReady();
    /**
    *Call to check if the placement is capped
    */
    mMediationAgent.isInterstitialPlacementCapped("Placement");
    

    With the ironSource Methods:

    /**
    *Call to request an interstitial ad
    */
    IronSource.loadInterstitial();
    /**
    *Call to show an interstitial ad 
    */
    IronSource.showInterstitial();
    /**
    *Call to check ad availability
    */
    IronSource.isInterstitialReady();
    /**
    *Call to check if the placement is capped
    */
    IronSource.isInterstitialPlacementCapped("Placement");
  • Offerwall
    Replace the following Supersonic methods:

    /**
    *Call to check ad availability
    */
    mMediationAgent.isOfferwallAvailable();
    /**
    *Call to show Offerwall when user clicks the Offerwall button 
    */
     mMediationAgent.showOfferwall();

    With the ironSource Methods:

    /**
    *Call to check ad availability
    */
    IronSource.isOfferwallAvailable();
    /**
    *Call to show Offerwall when user clicks the Offerwall button 
    */
    IronSource.showOfferwall();

 

DynamicUserId (Only for Rewarded Video)

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 ShowRewardedVideo.

IronSource.setDynamicUserId("UserID");

Step 4. Update Callbacks

Lastly, you will need to update the Listener classes for the ad units you’d like to serve on your app .

Rewarded Video:

IronSource.setRewardedVideoListener(new RewardedVideoListener() {
    @Override
    public void onRewardedVideoAdOpened() {
        
    }
    @Override
    public void onRewardedVideoAdClosed() {
    }
    @Override
    public void onRewardedVideoAvailabilityChanged(boolean available) {
    }
    @Override
    public void onRewardedVideoAdStarted() {
    }
    @Override
    public void onRewardedVideoAdEnded() {
    }
    @Override
    public void onRewardedVideoAdRewarded(Placement placement) {
    }
    @Override
    public void onRewardedVideoAdShowFailed(IronSourceError error) {
    }
});

Interstitial:

IronSource.setInterstitialListener(new InterstitialListener() {
    @Override
    public void onInterstitialAdReady() {
    }
    @Override
    public void onInterstitialAdLoadFailed(IronSourceError error) {
    }
    @Override
    public void onInterstitialAdOpened() {
    }
    @Override
    public void onInterstitialAdClosed() {
    }
    @Override
    public void onInterstitialAdShowSucceeded() {
    }
    @Override
    public void onInterstitialAdShowFailed(IronSourceError error) {
    }
    @Override
    public void onInterstitialAdClicked() {
    }
});

Offerwall:

IronSource.setOfferwallListener(new OfferwallListener() {
    @Override
    public void onOfferwallAvailable(boolean isAvailable) {
    }
    @Override
    public void onOfferwallOpened() {
    }
    @Override
    public void onOfferwallShowFailed(IronSourceError error) {
    }
    @Override
    public boolean onOfferwallAdCredited(int credits, int totalCredits, boolean totalCreditsFlag) {
        return false;
    }
    @Override
    public void onGetOfferwallCreditsFailed(IronSourceError error) {
    }
    @Override
    public void onOfferwallClosed() {
    }
});

 

Done! You just updated to the latest ironSource SDK! 
You are now ready to start working with ironSource’s Ad Units and our advanced mediation platform.


What’s Next?

Once you’ve verified your integration with the Integration Helper, follow our integration guides and implement our Ad Units:

Interested in Mediation? Integrate our Rewarded Video or Interstitial Ads in your app and follow our Mediation articles.