Android SDK Integration
Download Android SDK file
Download the SDK file from this link
Installation
First, the .aar file needs to be imported into your Android app which is using Gradle system
- Open Android Studio
- Go To File ->Project Structure ->Module
- Click on '+' symbol to add new Module
- Select "Import .JAR/.AAR Package "and select Next
- Open File Browser, and Select the downloaded .aar file
-
Select Finish and Apply
-
Open your app module's .gradle file, and add following line in 'dependencies' section
implementation project(path: ':offerwallsdk')
Permissions
If not already added, add following permission to your AndroidManifest.xml file
<uses-permission android:name="android.permission.INTERNET"/>
Usage
Show Offer Wall
RFGOfferwallManager will be the primary object to use OfferWalls in your Android application. Use Following code snippet to get started
RFGOfferwallManager manager = RFGOfferwallManager.getInstance();
manager.setPartnerId("<Partner-ID>");
manager.setUserId("<User-ID>");
manager.setTitle("<Custom-Title>");
manager.setEventsCallback(new IRFGOfferWallEventsCallback() {
@Override
public void onOfferWallOpened() {
Log.i(this.getClass().getSimpleName(), "Offer Wall Opened");
}
@Override
public void onOfferWallClosed() {
Log.i(this.getClass().getSimpleName(), "Offer Wall Closed");
}
@Override
public void onOfferWallLoadError() {
Log.i(this.getClass().getSimpleName(), "Offer Wall in Error");
}
@Override
public void onRewardsReceived() {
Log.i(this.getClass().getSimpleName(), "Received Payout::" + payout);
}
});
manager.showOfferWall(this);
RFGManager.getInstance() will provide an instance of RFGManager that can be used to do the required stuff.
- Use setPartnerId() to set Partner ID of the request
- Use setUserId() to set Unique user ID from your application to identify each user
- Use setTitle() to set custom Title of the OfferWall
- Use setEventsCallback() to listen to events during OfferWall lifecycle
- Use showOfferWall() to show OfferWall
Check if survey is available
Following code can be used to check if any survey is available before showing the OfferWall. This function can be used to trigger any custom logic in your application before OfferWall is displayed to user.
manager.isSurveyAvailable(new IRFGOfferwallSurveyAvailableCallback() {
@Override
public void onRequestCompleted(boolean isAvailable) {
if(isAvailable) {
// Show OfferWall, or Display button to Show OfferWall etc
} else {
// Notify User that Survey is not available etc.
}
}
});