Offerwall Integration for Android

The ironSource Offerwall presents engaging offers to your users in exchange for valuable virtual content. This engaging, user-initiated ad unit is great for gaming and utility apps; and enhances every app experience!

Get up and running with the Offerwall Ad Unit in 3 easy steps:

  1. Implement the Offerwall Listener
  2. Present the Offerwall
  3. Reward the User
Before You Start

Make sure that you have correctly integrated the ironSource SDK into your application. Integration is outlined here.

Step 1. Implement the Offerwall Listener

The ironSource SDK fires several events to inform you of the Offerwall activity and completions so you’ll know when to reward your users. Implement the listener to receive these Offerwall events.

The SDK will notify your listener of all possible events listed below:

IronSource.setOfferwallListener(new OfferwallListener() {
    /**
     * Invoked when there is a change in the Offerwall availability status.
     * @param - available - value will change to YES when Offerwall are available.
     * You can then show the offerwall by calling showOfferwall(). Value will *change to NO when Offerwall isn't available.
     */
    @Override
    public void onOfferwallAvailable(boolean isAvailable) {
    }
    /**
     * Invoked when the Offerwall successfully loads for the user, after calling the 'showOfferwall' method
     */
    @Override
    public void onOfferwallOpened() {
    }
    /**
     * Invoked when the method 'showOfferWall' is called and the OfferWall fails to load.
     * @param error - A IronSourceError Object which represents the reason of 'showOfferwall' failure.
     */
    @Override
    public void onOfferwallShowFailed(IronSourceError error) {
    }
    /**
     * Invoked each time the user completes an Offer.
     * Award the user with the credit amount corresponding to the value of the *‘credits’ parameter.
     * @param credits - The number of credits the user has earned.
     * @param totalCredits - The total number of credits ever earned by the user.
     * @param totalCreditsFlag - In some cases, we won’t be able to provide the exact
     * amount of credits since the last event (specifically if the user clears
     * the app’s data). In this case the ‘credits’ will be equal to the ‘totalCredits’, and this flag will be ‘true’.
     * @return boolean - true if you received the callback and rewarded the user, otherwise false.
     */
    @Override
    public boolean onOfferwallAdCredited(int credits, int totalCredits, boolean totalCreditsFlag) {
        return false;
    }
    /**
     * Invoked when the method 'getOfferWallCredits' fails to retrieve
     * the user's credit balance info.
     * @param error - A IronSourceError object which represents the reason of 'getOfferwallCredits' failure.
     * If using client-side callbacks to reward users, it is mandatory to return true on this event
     */
    @Override
    public void onGetOfferwallCreditsFailed(IronSourceError error) {
    }
    /**
     * Invoked when the user is about to return to the application after closing
     * the Offerwall.
     */
    @Override
    public void onOfferwallClosed() {
    }
});
Note:
Please do not assume the callbacks are always running on the main thread. Any UI interaction or updates resulting from ironSource callbacks need to be passed to the main thread before execution.

Step 2. Present the Offerwall

By correctly implementing the Offerwall Delegate and its functions, you can receive the availability status through the boolean isOfferwallAvailable(). You will then be notified with the listener function below upon Offerwall availability change: 

Once you receive Availability True, you can show the Offerwall (typically after a user clicks on some in-app button). Call the showOfferwall method:

IronSource.showOfferwall();

With ironSource’s Ad Placements, you can customize and optimize the Offerwall experience. This tool enables you to present the Offerwall to your users in various places, i.e. in your in-app store, between levels, in the main menu,  etc. You can use the below function to define the exact Placement to show the Offerwall. Navigate to the Ad Placement document for more details.

IronSource.showOfferwall(placementName);

Step 4. Reward the User

Make sure you’ve set the userID before you initialize the ironSource SDK in order to successfully reward your users.

ironSource supports two methods to reward your users. Select one of the following:

  1. Server-Side Callbacks
  2. Client-Side Callbacks
Method 1: Server-Side Callbacks

The default setting in your ironSource account notifies you of user’s completions or rewards via the didReceiveOfferwallCredits callback within the client of your app. Alternatively, you can turn on server-to-server callbacks to receive notifications to your back-end server. Once you select server-to-server callbacks you will not receive client-side notifications.

We recommend turning on server-to-server callbacks for Offerwall instead of client-side callbacks, as the authenticity of the callback can be verified. With server-to-server callbacks, you will have better control over the rewarding process as the user navigates out of your app to complete the offer.

Note:

  • If you turn on server-to-server callbacks , remember not to reward the user more than once for the same completion.
  • We will fire a server-to-server callback to the selected location with an Event ID which is the unique identifier of the transaction. For us to know you’ve granted the user, you must respond to the callback with [EVENT_ID]:OK anywhere within the HTTP payload of the callback.
  • To utilize server-to-server callbacks, see here.

Method 2: Client-Side Callbacks

  • Proactive Polling API

You may call the function getOWCredits at any point during the user’s engagement with the app. You will then receive information on the user’s total credits and any new credits the user has earned.
See Step 1 for instructions on how to implement the protocol and receive callbacks for the following method:

IronSource.getOfferwallCredits();
  • Automatic Client-Side Events

You can receive client-side events automatically within your application by registering to the Offerwall listener and setting the use of client-side callbacks. Setting automatic client-side callbacks will make sure that you’re notified about the user’s credit status at specific points in the Offerwall’s lifecycle. To do so:

Important! This code MUST be implemented before calling the init.

SupersonicConfig.getConfigObj().setClientSideCallbacks(true);

Note:
If you are using automatic client-side events, we recommend adding the proactive polling method and checking the user’s reward status on app launch, upon in-app store entry and in the case a user opened the Offerwall, ardently verifying every 5 minutes after the user closes the Offerwall to ensure you don’t miss the latest update on the user’s rewards.

First Time Integration Tip

If this is a new integration for your application, your app will by default be in ‘Test Mode‘ on your ironSource dashboard. While your app is in Test Mode, the ironSource SDK will print more logs to the console in order to provide greater visibility into the SDK processes. To test your ad inventory, set up your Test Devices. Until you turn on live ad inventory, you will receive test campaigns that don’t generate revenue. Make sure to select Go Live! on the Ad Units page when your app is ready for live ad inventory.

ironsource-go-live-with-rewarded-video

Done!
You are now all set to deliver ironSource’s Offerwall in your application.


What’s Next?
Follow our integration guides to integrate additional ad units: