Introduction
To work with the Offer Wall Edge using the Fyber SDK you must ensure that you have:
- Integrated the Offer Wall Edge via the SDK.
- Successfully set up your app, properly configured the Fyber SDK.
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.
- Go to the Dashboard and click through to your selected App.
- Go to Placements and select the app from the list. Make sure Status is set to On.
- Select the currency you wish to use for video rewards from the Virtual currency dropdown menu.
- 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).
- 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.
- 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.
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.
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
data-lang="java">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: Fill
, No-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.
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.
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
// 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.
// 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
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:
- Using your Own Server
- Using Virtual Currency Server (VCS)
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.
Offer Wall Sample App for Android
Fyber's sample app can assist you in using Offer Wall within your app.
In addition, use the Fyber sample app as a reference during implementation to troubleshoot possible integration issues.
Sample App Link
Click here to view and download the sample app repository.