Interstitial/Rewarded Ads in Android

The implementation of interstitial and rewarded ads (banner and video) is the same. You have to choose the zone type in the panel.

Creating a Zone

First, create a zone from the Tapsell panel and use the zoneId when requesting or showing an ad.

Requesting Ads

To request an ad in your application, use the following method:

        new TapsellAdRequestOptions(),
        new TapsellAdRequestListener() {
            public void onAdAvailable(String adId) {
              // KEEP adId

            public void onError(String message) {

The first argument is CONTEXT.
The second argument is the ZONE_ID which you can get from your panel.
The third argument OPTIONS is of type TapsellAdRequestOptions. You can configure your ad request with this argument. The fourth argument is TapsellAdRequestListener.

The details of TapsellAdRequestListener methods are shown in the table below:

The requested ad is ready to be shown. The ad id is in the adId variableonAdAvailable
An error has occured and you can see the error message in the message variableonError

Request Options

You can change the way a video is cached with the help of the argument options, such as the lines below:

TapsellAdRequestOptions options = new TapsellAdRequestOptions();

The CACHE_TYPE attribute can take the values below:

It starts to download the video while showing the adTapsellAdRequestOptions.CACHE_TYPE_STREAMED
It downloads the video before showing the adTapsellAdRequestOptions.CACHE_TYPE_CACHED

To lower the data usage, only use the CACHE_TYPE_CACHED option when the probability of user watching the ad is high.

Showing Ads

You can start showing the ad using the following lines of code:

        new TapsellShowOptions(),
        new TapsellAdShowListener() {
            public void onOpened() {

            public void onClosed() {

            public void onError(String message) {

            public void onRewarded(boolean completed) {

The first argument is CONTEXT. The second argument is ZONE_ID, which you used to request an ad.
The third argument is AD_ID, which you get in the onAdAvailable callback method. The fourth argument is TapsellShowOptions that you can use to configure how to show your ad.
The fifth argument is TapsellAdShowListener that you can use to follow the steps of showing the ad.

The TapsellAdShowListener methods are shown in the table below:

It is called when the ad is openedonOpened
It is called when the ad is closedonClosed
It is called when an error occurs during the process of showing the adonError
It shows the status of receiving the rewarded in the rewarded adsonRewarded

Show Options

You can configure how to show your ad with the help of the showOptions argument.

TapsellShowOptions showOptions = new TapsellShowOptions();

You can give each of the methods above true or false to enable or disable that functionality. The possible values for ROTATION_MODE is explained further down.

The functionality of each method is explained in the table below:

Disabling the back button while showing the adsetBackDisabled
Enabling the immersive mode while showing the adsetImmersiveMode
Showing a warning dialog while closing the ad before it finishes showingsetShowDialog
Determining the rotation mode of the phone when the ad is displayedsetRotationMode

The setRotationMode attribute can take the values below:

Based on the state of the phoneTapsellShowOptions.ROTATION_UNLOCKED
Reversed verticalTapsellShowOptions.ROTATION_LOCKED_REVERSED_PORTRAIT
Reversed horizontalTapsellShowOptions.ROTATION_LOCKED_REVERSED_LANDSCAPE

Getting The Result of Rewarded Ads

If the completed variable in the rewarded method is true in the rewarded ads, you can give the user her/his reward.