To work with the DT Offer Wall Edge using the DT SDK you must ensure that you have:
- Integrated the Offer Wall Edge via the SDK.
- Successfully set up your app, properly configured the DT SDK.
Performing the Integration
Properly integrating the DT Offer Wall Edge requires updating both the developer Dashboard and the SDK.
Step 1: Enabling the DT Offer Wall
Configuring the DT Dashboard
As with most of our products, you first need to configure the Dashboard before you can start coding.
Once you have configured the DT Offer Wall Edge, you can proceed directly to Step 2: Handling the Fill Response.
Before you can configure the DT 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 your selected App.
- Please make sure to enable the app and select your preferable metrics according to the getting started article under Creating Placements.
Step 2: Requesting the DT Offer Wall
Using the DT 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 DT Offer Wall you can request a Placement by passing the Placement ID.
OfferWallRequester.create(requestCallback)
.withPlacementId("your_placement")
.request(context);
Controlling DT DT 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, DT Offer Wall Edge closes automatically. |
false |
When the user returns to your app, DT Offer Wall Edge remains open and refreshes the list of offers. |
By default, the DT Offer Wall Edge remains open. This is equivalent to passing false
to closeOnRedirect(shouldCloseOfferwall)
.
Best Practice Check
If you are rewarding with VCS, DT recommends setting the DT 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 DT 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 | DT Offer Wall Edge Availability |
---|---|---|
onAdAvailable |
Fill | Available |
onRequestError |
Error | Not Available |
DT Offer Wall Edge availability does not necessarily indicate offer availability. DT Offer Wall Edge is still available, even if no offers can be shown to the user.
In this case, the DT Offer Wall Edge presents a message indicating that there are no offers available.
Using the Request Callback
Once you have requested the DT 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 DT 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 DT Offer Wall
Your RequestCallback
provides you with an intent
when a request for the DT Offer Wall Edge successfully provides a fill. You can start that intent
at any time to display the DT 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 DT 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, DT 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, DT 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
All rewarded ad formats use the same rewarding mechanism. Therefore, it is important to remember that your choices here also affect Rewarded Video.
DT Offer Wall Sample App for Android
DT's sample app can assist you in using DT ffer Wall within your app.
In addition, use the DT 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.