🔌Initialize the SDK

You must initialize the SDK before using the SDK. To do this, call Offerwall.init(OfferWallConfig, OfferWallInitListener) .

Parameters for init call:

  • OfferWallConfig offerWallConfig: An object to pass configuration-related info to the SDK while initializing. Refer below for how to create an object of OfferWallConfig.

  • OfferWallInitListener offerWallInitListener: A listener that informs you if the SDK initialization was successful or not. In case of failure, it will also give you a string stating the cause of the failure. This parameter is optional.

Creating OfferWallConfig object:

Create an instance of OfferWallConfig using the builder class OfferWallConfig.Builder by passing the context and your PubScale app ID.

import com.pubscale.sdkone.offerwall.OfferWallConfig
..
..
val offerWallConfig = OfferWallConfig.Builder(context, "YOUR_PUBSCALE_APP_ID")
   .setUniqueId("unique_id") //optional, used to represent the user of your application
   .setLoaderBackgroundBitmap(backgroundBitmap) //optional
   .setLoaderForegroundBitmap(foreground) //optional
   .setFullscreenEnabled(false) //optional
   .build()

These are the public methods available for OfferWallConfig.Builder class:

Public Methods
Description

setUniqueId(String uniqueId)

Sets a unique id that will be used to identify the user uniquely. This will be sent back in the postback.

setFullscreenEnabled(Boolean isEnabled)

Sets if the offerwall should open in fullscreen mode or not. Default: false

setLoaderBackgroundBitmap(Bitmap bitmap)

Accepts a bitmap and uses it as the background image for the loader and offerwall top banner. Default: Black color image

setLoaderForegroundBitmap(Bitmap bitmap)

Accepts a bitmap and uses it as the foreground image for the loader and offerwall top banner. Default: App icon

build()

Builds the config and returns OfferWallConfig instance

Initialize the Offerwall SDK:

Initialize the OfferWall SDK by calling the init function by passing the offer wall config.

OfferWall.init(offerWallConfig, object : OfferWallInitListener {
   override fun onInitSuccess() {
   }
   override fun onInitFailed(error: InitError) {
   }
})

OfferWallInitListener is an optional parameter in init() method.

If you need to change any config after initializing the SDK, you should destroy and re-init the SDK.

To destroy, call OfferWall.destroy()

Last updated