Android SDK - Fyber Offer Wall

The Heyzap SDK provides access to the Fyber Offer Wall as of SDK version 9.12.0 and above. The Offer Wall allows your users to complete certain activities in exchange for in-game currency.

In order to use the Offer Wall in your app, make sure to include the latest Fyber SDK when adding ad networks, configure and enable Fyber on your Mediation Settings dashboard, and configure Offer Wall on your Fyber Dashboard.

Fetch

To fetch an Offer Wall ad (which will always succeed unless the Fyber SDK is not present/configured/enabled, or if the tag is disabled):

  OfferWall.fetch("default");

To check if an Offer Wall ad is available (it will always be unless the Fyber SDK is not present/configured/enabled, or if the tag is disabled):

  OfferWall.isAvailable("default");

Show

To show an Offer Wall ad, configure the OfferWallOptions class:

  OfferWall.OfferWallOptions offerWallOptions = new OfferWall.OfferWallOptions();
  offerWallOptions.closeOnRedirect = true; // auto-close after first offer interaction?
  OfferWall.display(this, "default", offerWallOptions);

Setting Up Callbacks

To track validated rewards via Fyber's Virtual Currency Server (necessary to reward users for Offer Wall interactions), you must register a listener and request VCS updates periodically.

If the response object's getDeltaOfCoins() returns a nonzero value, give that amount of the currency identified by getCurrencyId() to the user. Subsequent VCS requests will have a deltaOfCoins of 0 until the user completes another offer, so you can always use this value to determine how much to award the user without worrying about over-rewarding.

Here's the code you'll need to use to set the listener and listen for a response:

Callbacks

The OnStatusListener callback is used for Offer Wall just like our other ad formats. These can be used to track fetch success/failure, show success/failure, ad dismissal, etc. Details about these can be found on our advanced docs.

Rewarding the User

On Fyber's dashboard, you can configure the currency ID and exchange rate for your users to earn from the Offer Wall.

In order to not double reward users for Rewarded Video views from Fyber via Fyber's VCS system, it is important that you set up a separate currency for Offer Wall and Rewarded Video on the Fyber Dashboard, and only request VCS updates for the Offer Wall currency. This is important since Fyber offers the same VCS system for both ad formats, but Heyzap Mediation does not support Fyber's VCS system for Rewarded Videos.

You will need to call the requestVirtualCurrencyUpdate() method periodically to check for validated offers. This method will trigger a response via the listener methods above. Offers are validated server-side and can take any amount of time, depending on the offer, so there may be some time between the user's offer completion and a successful VCS callback. Fyber suggests requesting an update:

  • 5 seconds after the Offer Wall is closed, and
  • once every time your user returns to a screen that displays how much currency they have, such as the main menu of your game.

To request the VCS update and check for any new rewards:

  OfferWall.VirtualCurrencyCallback callback = new OfferWall.VirtualCurrencyCallback() {
      @Override
      public void onError(OfferWall.VirtualCurrencyErrorResponse virtualCurrencyErrorResponse) {
      }

      @Override
      public void onSuccess(OfferWall.VirtualCurrencyResponse virtualCurrencyResponse) {
         double newCoinsToAward = virtualCurrencyResponse.getDeltaOfCoins();
         String currencyIdOfNewCoins = virtualCurrencyResponse.getCurrencyId();
         // Reward your user the `newCoinsToAward`
      }
  };

  OfferWall.requestVirtualCurrencyUpdate(callback, "gold_coin") // pass the currency ID you configured on Fyber's dashboard

Fyber's docs have more advanced information on configuring the Offer Wall if you are interested.