Offerwall Migration Guide

  1. Firstly, you need to integrate the ironSource Tapjoy adapter. You can add this to your gradle file like so:
maven { url "https://sdk.tapjoy.com/"}
implementation 'com.ironsource.adapters:tapjoyadapter:4.1.23'
implementation 'com.tapjoy:tapjoy-android-sdk:12.11.1'

You can find the latest adapter version here.

  1. As you can see, as well as the adapter, we are adding the Tapjoy SDK so you can call Tapjoy SDK functions directly. This is what we need to do to display the Tapjoy Offerwall. First, we need to import Tapjoy into your class:
import com.tapjoy.Tapjoy;
  1. Then we need to initialise the Tapjoy SDK. You will receive a callback when this succeeds (or fails) and you should not make any Tapjoy SDK calls until you have received the success callback.
Hashtable<String, Object> connectFlags = new 
Hashtable<String, Object>();

Tapjoy.connect(getApplicationContext(), "TJ_SDK_KEY", connectFlags, new TJConnectListener() {
  @Override
  public void onConnectSuccess() {

  } 
      
  @Override
  public void onConnectFailure() {

  }
});
  1. Define two new class variables:
private TJPlacementListener placementListener = this;
private TJPlacement placement;
  1. Next we configure our placement object. A placement is something you configure on the Tapjoy dashboard and it will contain your Offerwall content card. In this example we are assuming you have named your placement ‘Offerwall’. In reality you can name it whatever you want but the name you use here in your code must match the dashboard.
placement = Tapjoy.getPlacement("Offerwall", placementListener);
  1. Now you are ready to request your placement. With this call we are loading the placement so it is ready when you choose to display it. An Offerwall placement should load quickly, but it’s best call this in advance of when you think you will display the Offerwall.
placement.requestContent();
  1. We offer a range of callbacks which you should implement.
public void onRequestSuccess(TJPlacement placement); 
public void onRequestFailure(TJPlacement placement, TJError error);
public void onContentReady(TJPlacement placement); 
public void onContentShow(TJPlacement placement);
public void onContentDismiss(TJPlacement placement);
public void onPurchaseRequest(TJPlacement placement, TJActionRequest request, String productId);
public void onRewardRequest(TJPlacement placement, TJActionRequest request, String itemId, int quantity);
public void onClick(TJPlacement placement);

Some of these can replace the ironSource callbacks (available via the OfferwallListener) you may have already implemented. You can see the corresponding callbacks in the table below so that you can easily move any custom logic into the appropriate Tapjoy callbacks:

ironSource Callback Tapjoy Callback
onOfferwallOpened onContentShow
onOfferwallClosed onContentDismiss
onOfferwallAvailable onContentReady

onRequestSuccess will be called when the content request returns from Tapjoy’s servers. onContentReady will be called when the content (Offerwall) is ready to display. At this point you can either display Offerwall, or set some flag so that you know it is ready to display when you need it.

  1. To display your Offerwall placement you should check the content is ready, and then call showContent:
if(placement.isContentReady()) {
  placement.showContent();
}

This will replace your existing ironSource call:

IronSource.showOfferwall();
  1. Once the user has dismissed the Offerwall you must request the content again. You cannot show a placement multiple times. We would recommend that you request the placement in the onContentDismiss callback so that it is ready to display again the next time a user requests it.

  2. You can now remove any remaining ironSource Offerwall code. For example, you no longer need to set the ironSource Offerwall listener and if your class implements “OfferwallListener” you should remove this reference.