Android SDK
This page describes how to install the AdGate Media iOS SDK.
Requirements
Android SDK minimum version 14 (Ice Cream Sandwich 4.0)
Minimum hardware requirement is ARMV7
Java JDK 1.6 or greater
1. Install SDK
Instructions provided here are for Android Studio. aar libraries are not yet supported on Eclipse, though some solutions are available online.
Download the latest aar file from https://github.com/adgatemedia/adgate-rewards-android-sdk/releases
Add the aar file to your project, by copying it into your project's libs folder.
Add the following lines of code to your app's
build.gradle
file, so that Android Studio recognizes and builds the library along with your app.
At this point Android Studio shouldn't throw any errors related to the library.
2. Load the offer wall
In your activity, where you intend to show the offer wall, add the following import statement:
To load the offer wall, from any place in your running activity add the following code:
Remember to set wallCode
and userId
to the appropriate values. You can get your AdGate Rewards wall code from the Dashboard. The userId
values can be any alphanumeric string. You may add up to 4 subid strings to the HashMap: s2, s3, s4, and s5.
3. Display the offer wall
Once offer wall is loaded you can display it by calling the showOfferWall method.
4. Get a list of the latest offer wall conversions
To get a list of latest offer wall conversions for a particular user run the following code in your activity:
The wallCode
for your AdGate Rewards wall can be found on the AdGate Rewards panel page. The userId
value is your app's internal user id for whom you'd like to check for conversions. subids
is a hashmap of the subid's that was used when loading the offer wall.
If the call was successful, a list of conversions is passed to the onSuccess
method. Each Conversion model has the following class definition:
6. Enable console messages
To enable debugging, warning, and error messages run the following line of code:
This will log messages to the console as well as to a log file. Make sure you disable debug mode before publishing your app to the Google Play Store.
7. Demo app
This repository contains a demo Android app that shows how to implement our SDK.
Last updated