Configuring the Integration

Introduction

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

Performing the Integration

Properly integrating the Offer Wall Edge requires updating both the developer Dashboard and the SDK.

Step 1: Enabling the Offer Wall 

Configuring the Fyber Dashboard

As with most of our products, you first need to configure the Dashboard before you can start coding.

Once you have configured the Offer Wall Edge, you can proceed directly to Step 2: Handling the Fill Response.

Note

Before you can configure the Offer Wall Edge, 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.

  1. Select the currency you wish to use for video rewards from the Virtual currency dropdown menu.

  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 video rewards to 1 unit of virtual currency (recommended) if you want to show video offers that reward less than 1 of your virtual currency.
    In such cases, the video has its reward rounded up to 1.

  1. Click Save to save your Offer Wall configurations.

Step 2: Requesting the Offer Wall 

Using the Offer Wall Edge Requester

You must create an instance of a OfferWallRequester to use to make the request for offers. You may choose to store the OfferWallRequester or use it immediately.

The call to request returns immediately. The result of the request is sent to the RequestCallback methods asynchronously when the request is complete.

Requesting the Offer Wall
import com.fyber.requesters.OfferWallRequester;

[...]

// We can create the requester and generate the request in the same line
OfferWallRequester.create(requestCallback)
                            .request(context);

Our SDK prevents the app from making consecutive requests while there is an ongoing request.

Requesting a Placement

If you are using Placements on the Offer Wall you can request a Placement by passing the Placement ID.

Requesting an Offer Wall Placement
OfferWallRequester.create(requestCallback)
                  .withPlacementId("your_placement")
                  .request(context);
Controlling Offer Wall Edge Behavior after Offer Redirecting

When a user clicks on offers, they are redirected outside of your app to complete those offers. You can choose to set the behavior by chaining a call to closeOnRedirect(shouldCloseOfferwall) when creating the OfferWallRequester.

Value Behavior
true When the user returns to your app, Offer Wall Edge closes automatically.
false When the user returns to your app, Offer Wall Edge remains open and refreshes the list of offers.

By default, the Offer Wall Edge remains open. This is equivalent to passing false to closeOnRedirect(shouldCloseOfferwall).

Best Practice Check

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

Controlling the close behavior
import com.fyber.requesters.OfferWallRequester;

[...]

// We can create the requester, set the close behavior, and generate the request in the same line
OfferWallRequester.create(requestCallback)
                        .closeOnRedirect(shouldCloseOfferwall)
                        .request(context);

Step 3: Handling the Fill Response

Before you can request the Offer Wall Edge, you need to have a RequestCallback set up to receive the result of your asynchronous request.

Handling the response requires dealing with the one of three possible scenarios: FillNo-fill, or Error. Here are the methods to help:

Method Scenario Offer Wall Edge Availability
onAdAvailable Fill Available
onRequestError Error Not Available

Note

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

In this case, the Offer Wall Edge presents a message indicating that there are no offers available. 

Using the Request Callback

Once you have requested the Offer Wall Edge, you need to make sure it is available before you can actually show it. The Offer Wall Edge is available only when onAdAvailable is called and provides you with a valid intent.

In all other cases, the Offer Wall Edge is not available to be shown.

Receiving the Offer Wall Intent
import com.fyber.Fyber;

RequestCallback requestCallback = new RequestCallback() {

    @Override
    public void onAdAvailable(Intent intent) {
        // Store the intent that will be used later to show the Offer Wall
        offerwallIntent = intent;
        Log.d(TAG, "Offers are available");
    }

    @Override
    public void onAdNotAvailable(AdFormat adFormat) {
        // Since we don't have an ad, it's best to reset the Offer Wall intent
        offerwallIntent = null;
        Log.d(TAG, "No ad available");
    }

    @Override
    public void onRequestError(RequestError requestError) {
        // Since we don't have an ad, it's best to reset the Offer Wall intent
        offerwallIntent = null;
        Log.d(TAG, "Something went wrong with the request: " + requestError.getDescription());
    }
};

You may choose to start the intent provided in onAdAvailable immediately, or else store it so that you can present the video to the user at a later time. This decision is based on how you choose to optimize your integration.

Step 4: Displaying the Offer Wall

Your RequestCallback provides you with an intent when a request for the Offer Wall Edge successfully provides a fill. You can start that intent at any time to display the Offer Wall Edge to your user.

Starting the intent
// The OfferWallIntent will have been returned in onAdAvailable, and is started like any other intent
startActivity(offerWallIntent);

Best Practice Check

We recommend that you start the Offer Wall Edge immediately when you receive the Offer Wall Edge intent. A good place to do this would be inside the onAdAvailable method of the RequestCallback. 

Using onActivityResult(...)

If you want to receive information when the Offer Wall Edge closes, you can start the intent with startActivityForResult(...).

Starting the intent
// We need a request code that we can use later to identify the offer wall activity when it finishes
protected static final int OFFER_WALL_REQUEST_CODE = 1234;

[...]

// The OfferWallIntent will have been returned in onAdAvailable, and is started like any other intent
startActivityForResult(offerWallIntent, OFFER_WALL_REQUEST_CODE);

When the Offer Wall Edge is dismissed, onActivityResult(...) is called.

Displaying the Offer Wall and handling the result
// We need a request code that we can use later to identify the offer wall activity when it finishes
protected static final int OFFER_WALL_REQUEST_CODE = 1234;

[...]

// As is standard in Android, onActivityResult will be called when any activity closes that had been started with startActivityForResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == OFFER_WALL_REQUEST_CODE) {
        // handle the closing of the Offer Wall
    }
}

Step 5: Rewarding the User

There are two options for rewarding the users with virtual currency:

  1. Using your Own Server
  2. Using Virtual Currency Server (VCS)

Note

Make sure to read the Rewarding your Users section to discover the advantages of each method.

First, set up the developer Dashboard for the option you choose and then add the code necessary on the SDK side. Let's get started.

For more details on Reward Handling, click here

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 more details on Server-Side Hosting

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 more details on VCS Hosting

Note

All rewarded ad formats use the same rewarding mechanism. Therefore, it is important to remember that your choices here also affect Rewarded Video. 

Activating Fyber Logging

Fyber provides custom logging to help you troubleshoot your integration. You should activate logging before starting up the Fyber SDK to ensure you will have logs of the startup itself.

Activate Logging
import com.fyber.Fyber;

[...]

@Override
protected void onResume() {
    Fyber.with(appId, activity)
                .withUserId(userId)
                .withSecurityToken(securityToken)
                .start();
}

Best Practice Check

We recommend you disable logging before going live.

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 for all apps 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
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request