1. Home
  2. Publishers
  3. Advanced features in SDK

Advanced features in SDK

Check if an Ad is cached and ready to be shown

Besides the callback passed to requestAd method, you can use the following method to check  whether SDK has fetched an ad item and the ad is ready to be shown.

Tapsell.isAdReadyToShow(context, zoneId);

In this method, zoneId argument is the id of relevant zone in which you want to show an ad.

 

Get SDK version

The following method returns the version of Tapsell SDK which is being used.

Tapsell.getVersion();

 

Caching configurations

As mentioned in previous step, since version 3.0.0 and above, Tapsell SDK supports caching video ads prior to showing them to the user. By using this feature, user doesn’t face consecutive lags watching the video while having weak network connection.

On the other hand, using this feature in real-time apps and games might result in lags while user is using main features of application. To avoid this issue, Tapsell SDK provides a few functions which can be used to limit the bandwidth allocated to downloading video file.

The function below can limit allocated bandwidth for downloading file to a certain percentage of total available bandwidth for the app.

Tapsell.setMaxAllowedBandwidthUsagePercentage(context, maxPercentage);

The second input argument of this function is an integer indicating the maximum percentage of bandwidth which Tapsell is allowed to use for downloading video files (must be between 10 and 100).

If you have already calculated available bandwidth using you own codes, you can use the method given below to allocate a certain amount of bandwidth for downloading video files.

Tapsell.setMaxAllowedBandwidthUsage(context, maxBpsSpeed);

The second argument is a number of type long which indicates the maximum speed for downloading video files in Bytes Per Second.

If you wish to disable the current bandwidth allocation settings in your application, you can use the method given below.

Tapsell.clearBandwidthUsageConstrains(context);

 

Asking for Run-Time Permissions

Since Android version 6 (Marshmallow and above) some permissions must be requested from user in run-time. Tapsell SDK uses READ_PHONE_STATE permission which is one of mentioned permissions. Tapsell provides a way to request this permission from the user which is active by default. If you want to implement your own way of requesting for permission from the user in you app, you can disable this feature by creating an object of TapsellConfiguration class and use the code given below to initialize Tapsell.

TapsellConfiguration config = new TapsellConfiguration();
config.setAutoHandlePermissions(false);
Tapsell.initialize(context, config, appKey);

 

Debug Mode

Developers might confront errors and difficulties implementing Tapsell SDK if they do not follow the steps in docs accurately. Tapsell SDK provides a debug mode which can ease the process of debugging. While debug mode is active, developer can see the logs of Tapsell SDK using logcat in Android Monitor. To enable debug mode, you should create an object of TapsellConfiguration class and use the below code to initialize Tapsell.

TapsellConfiguration config = new TapsellConfiguration();
config.setDebugMode(true);
Tapsell.initialize(context, config, appKey);

 

Then open logcat located in Android Monitor tab of Android Studio to see the logs.

 

Please let us know whether this document was helpful and what complications you faced while using Tapsell Android SDK.

 

Prev: Using Tapsell SDK in your app

 

Was this article helpful?

Related Articles