Android Integration
Offerwalls are in-app ads that incentivize users to take particular actions. In return, the user gets an in-app reward and the developer gets paid by the advertiser.
Before you start
To set up the PubScale Offerwall, you’ll need to add your app to our platform. Follow this guide for instructions on how to set up your app. Once completed, you will receive a unique 8-digit app ID.
1. Add this to your build.gradle file
Add the below line inside the dependencies block in your build.gradle file. Once added, clean build and rebuild the project.
2. Configure proguard rules
For the SDK to work properly in release(obfuscated/minified) builds, add the following rules in your proguard-rules.pro file.
3. Initializing the OfferWall
You must initialize the SDK before using the SDK. To do this, call Offerwall.init(OfferWallConfig, OfferWallInitListener)
.
3.1. 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.
3.2. Creating OfferWallConfig object:
Create an instance of OfferWallConfig using the builder class OfferWallConfig.Builder by passing the context and your PubScale app ID.
Obtain your PubScale app ID from the PubScale Dashboard by adding your app and configuring the offerwall. Once completed, you will receive a unique 8-digit app ID.
Use sandbox environment app ID for testing purposes.
Sandbox Environment - Learn how to setup Sandbox environment
These are the public methods available for OfferWallConfig.Builder class:
setUniqueId(String uniqueId)
Sets a unique id that will be used to identify the user uniquely. This will be sent back in the postback.
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
setFullscreenEnabled(Boolean isEnabled)
Sets if the offerwall should open in fullscreen mode or not. This can be used in apps or games where an immersive experience is needed. Default: false
build()
Builds the config and returns OfferWallConfig instance
If a unique ID is not set, rewarding the user is not guaranteed.
3.3. Making the init call:
Initialize the OfferWall SDK by calling the init function by passing the offer wall config.
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()
4. Start the OfferWall
To start the offerwall, just call, OfferWall.launch(Context, OfferWallListener);
A listener can be set to listen for events fired by the Offer Wall.
onRewardClaimed callback gives you the reward amount and currency details.
To start the OfferWall, call the launch method of the OfferWall class.
5. Setup S2S callbacks
Setup the S2S callbacks to get instant updates whenever the user gets the reward. You can use this callback to reward the user in your application. Learn more.
6. Test the OfferWall
Please use the sandbox environment for testing purposes to get instant callbacks and rewards. To learn how to enable the Sandbox environment, click here.
Finally, To test the offerwall, build the application to an actual device. Check if you can launch the Offerwall and get the appropriate callbacks.
Last updated
Was this helpful?