Configuring the Integration

Introduction

To work with the Offer Wall Edge using the Fyber SDK you must ensure that you have:

Step 1: Enabling the Offer Wall

Note

Before you can configure the Offer Wall, you must make sure that you have your virtual currency configured. If you have not already done so, you can add additional virtual currencies here.

  1. Go to the Dashboard and click through to your selected App.
  2. Go to Placements and select the app from the list. Make sure Status is set to On.
3ff9ca1-Screen_Shot_2020-03-04_at_14.08.47__1_.png
  1. Select the currency you wish to use for video rewards from the Virtual currency dropdown menu.
a4b6f48-Screen_Shot_2020-03-04_at_14.10.02__2_.png
  1. In the Exchange rate field enter the number of your virtual currency that equates to one Euro or Dollar (depending on the currency you have set in your account settings).
  2. Select the Round up low rewards to 1 unit of virtual currency (recommended) if you want to show offers that reward less than 1 of your virtual currency.
    In such cases, its reward rounded up to 1.
4d4b545-Screen_Shot_2020-03-04_at_14.11.57__2_.png
  1. Click Save to save your Offer Wall configurations.
0ec7b97-Screen_Shot_2020-01-21_at_11.47.26.png

Setting up the Offer Wall

 

Step 2: Requesting the Offer Wall

Note

First you request the Offer Wall, then you display it.

Using the Offer Wall Requester

To make a request for the Offer Wall you must create an instance of an OfferWallRequester through the Create method. You may choose to store the OfferWallRequester instance or use it immediately, chaining methods as in the following example.

C# - Requesting the Offer Wall
using FyberPlugin;

[...]

OfferWallRequester offerWallRequester = OfferWallRequester.Create();

[...]

offerWallRequester.Request();

The call to Request returns immediately. However, the result of the request is asynchronous and is explained in Handling the Fill Response below. 

Controlling Offer Wall Behavior after Offer Redirecting

When a user clicks on offers, they are redirected outside of your app to complete the offers. You can choose to set the behavior by calling the method CloseOnRedirect of the OfferWallRequester, before making the request.

Parameter Value Behavior
true When the user returns to your app, Offer Wall closes itself automatically.
false When the user returns to your app, Offer Wall remains open and refresh the list of offers.
C# - Example for controlling the close behavior
OfferWallRequester.Create()
            .CloseOnRedirect(shouldCloseOfferwall)
            .Request();

By default, Offer Wall remains open. This is equivalent to passing false to closeOnRedirect.

Best Practice Check

If you are rewarding with VCS, Fyber recommends setting the Offer Wall to close when returning to your app. This is equivalent to passing true to CloseOnRedirect.

Step 3: Handling the Fill Response

There are two ways of handling the asynchronous response after requesting the Offer Wall.

Select the method that you want to use in your integration.

Handling Response with Events

Handling the response requires dealing with one of three possible scenarios: FillNo-fill, or Error. The class FyberCallback contains the next events to help:

Event Scenario Offer Wall Availability
AdAvailable Fill Available
AdNotAvailable No-fill Not Available
RequestFail Error Not Available

You must set up some delegates to listen to those events.

In the case of a fill scenario, the AdAvailable event passes an instance of the Ad class that is saved to be used later to show the Offer Wall.

This is illustrated in the following example.

C# - Example - Listening response events
[...]

    private Ad ofwAd;

[...]

    void OnEnable()
    {
        FyberCallback.AdAvailable += OnAdAvailable;
        FyberCallback.AdNotAvailable += OnAdNotAvailable;   
        FyberCallback.RequestFail += OnRequestFail; 
    }

    void OnDisable()
    {
        FyberCallback.AdAvailable -= OnAdAvailable;
        FyberCallback.AdNotAvailable -= OnAdNotAvailable;   
        FyberCallback.RequestFail -= OnRequestFail; 
    }

    private void OnAdAvailable(Ad ad)
    {
        // store ad response
        if (ad.AdFormat == AdFormat.OFFER_WALL)
            ofwAd = ad;
    }

    private void OnAdNotAvailable(AdFormat adFormat)
    {
        // discard previous stored response
        if (adFormat == AdFormat.OFFER_WALL)
            ofwAd = null;
    }

    private void OnRequestFail(RequestError error)
    {
        // process error
        Debug.Log("OnRequestError: " + error.Description);
    }

Note

Offer Wall availability does not necessarily indicate offer availability. Offer Wall is still available, even if no offers can be shown to the user.

In this case, Offer Wall loads with a message indicating that there are no offers available.

 

Handling Response with Callbacks

Handling the response requires dealing with one of three possible scenarios: FillNo-fill, or Error. The interface RequestCallback contains the next methods to help:

Method Scenario Offer Wall Availability
OnAdAvailable Fill Available
OnAdNotAvailable No-fill Not Available
OnRequestError Error Not Available

You must create a class that implements that interface.

In the case of a fill scenario, the OnAdAvailable method receives an instance of the Ad class that is saved to be used later to show the Offer Wall.

Consider the following example as a guide to implementing the interface RequestCallback.

C# - Example: Handling response callbacks
using FyberPlugin;

[...]

public class OfferWallRequestCallback : RequestCallback
{
    public Ad ofwAd;

    public void OnAdAvailable(Ad ad)
    {
        // store ad
        if (ad.AdFormat == AdFormat.OFFER_WALL)
            ofwAd = ad;
    }

    public void OnAdNotAvailable(AdFormat adFormat)
    {
        // discard previous stored ad
        if (adFormat == AdFormat.OFFER_WALL)
            ofwAd = null;
    }

    public void OnRequestError(RequestError error)
    {
        // process error
        Debug.Log("OnRequestError: " + error.Description);
    }
}

To receive the response through the implemented RequestCallback instead of through events, you must pass an instance of it, using the method WithCallback, before making the request.

C# - Example: Making request with callback
[...]

OfferWallRequestCallback requestCallback = new OfferWallRequestCallback();

[...]

OfferWallRequester.Create()
            .WithCallback(requestCallback)
            .Request(); 

Step 4: Displaying Offer Wall

Once you've received an Offer Wall Ad you can display through its method Start, as in the following example:

C# - Example: Displaying Offer Wall
private Ad ofwAd;

    [...]

    private void ShowOfferWall()
    {
        if (ofwAd != null)
        {
            ofwAd.Start();
            ofwAd = null;
        }
    }

Offer Wall Notifications

If you want to be notified when the Offer Wall is started and closed this is performed through events or callbacks.

Select the method that you want to use in your integration. 

Handling Notifications Through Events

The class FyberCallback contains the events OnAdStarted to notify that the Offer Wall was opened, and OnAdFinished fired when the Offer Wall is closed.

C#
void OnEnable()
    {
        FyberCallback.AdStarted += OnAdStarted;
        FyberCallback.AdFinished += OnAdFinished;
    }

    void OnDisable()
    {
        FyberCallback.AdStarted -= OnAdStarted;
        FyberCallback.AdFinished -= OnAdFinished;  
    }

    [...]

    private void OnAdStarted(Ad ad)
    {
        if (ad.AdFormat == AdFormat.OFFER_WALL)
        {
            // this is where you mute the sound and toggle buttons if necessary
            ofwAd = null;
        }
    }

    private void OnAdFinished(AdResult result)
    {
        if (result.AdFormat == AdFormat.OFFER_WALL)
        {
            Debug.Log("Ofw closed with result: " + result.Status +
                " and message: " + result.Message);
        }
    }
 

Handling Notifications Through Callbacks

The interface AdCallback contains the methods OnAdStarted to notify that the Offer Wall was opened, and OnAdFinished fired when the Offer Wall is closed.

The following is an example of how to implement the interface AdCallback for Offer Wall.

C#
public class OfferWallAdCallback : AdCallback
{
    public void OnAdStarted(Ad ad)
    {
        // this is where you mute the sound and toggle buttons if necessary
        Debug.Log("OnAdStarted. Ad " + ad.AdFormat + " has started");
    }  

    public void OnAdFinished(AdResult result)
    {
        // this is the place where you can resume the sound
        // reenable buttons, etc
        Debug.Log("OnAdFinished. Ad " + result.AdFormat +
            " finished with status: " + result.Status +
            " and message: " + result.Message);
    }   
}

To be notified through the implemented AdCallback instead of through events, you must pass an instance of it, using the method WithCallback, before calling Start to show the Offer Wall.

C#
private OfferWallAdCallback adCallback = new OfferWallAdCallback();

    [...]

    private void ShowOfferWall()
    {
        if (ofwAd != null)
        {
            ofwAd.WithCallback(adCallback)
                .Start();
            ofwAd = null;
        }
    }

Step 5: Rewarding the User

There are two options when it comes to rewarding the users with virtual currency:

Option 1: Using your Own Server (Server Side)

If you are interested in using your own server to handle virtual rewarding to your users, Fyber can interact with it after you've set up your own server.

Click here for details on Server-Side Rewarding. 

Option 2: Using the Virtual Currency Server (VCS)

If you do not run your own servers, Fyber can provide you with virtual currency hosting. This is the default setting for mobile applications in the developer Dashboard.

Click here for details on VCS Rewarding.

Note

  • Make sure to read the Rewarding your Users section to discover the advantages of each method.
  • All rewarded ad formats use the same rewarding mechanism, so keep in mind that whatever you choose here also affects Rewarded Video.

You must set up the developer Dashboard for the option you choose and add the code necessary on the Unity side

Activating Fyber Logging

Fyber provides custom logging to help you troubleshoot your integration. Activate logging before starting up the Fyber Unity Plugin to ensure you have logs of the startup itself.

Call the following method:

Activate Logging
FyberLogger.EnableLogging(true);

Best Practice Check

We recommend you disable logging before going live.

Optional Android Method

It is also possible to activate logging on your test devices without having to make the specific call to enableLogging. This is useful if you want to pull your live build from the Google Play Store and troubleshoot it.

You can activate logging via an adb command:

Activate Logging
adb shell setprop log.tag.Fyber VERBOSE

After making the adb command, logging will be active on your test device until you disable the logging again. You can disable it again at any time with another adb command:

Deactivate Logging
adb shell setprop log.tag.Fyber SUPPRESS