Android SDK Integration
In this guide you will see how to integrate Monlix's offerwall into your Android games or applications.
Integration
- In the top level build.gradle file, add the following
For Gradle < 7
allprojects { repositories { ... maven { url 'https://jitpack.io' } }}
For Gradle > 7
, in the settings.gradle
, add maven
with { url 'https://jitpack.io' }
dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral() maven { url 'https://jitpack.io' } }}
- In the app level
build.gradle
file, add the dependency
implementation 'com.github.Monlix:android-sdk:v0.2'
- In the app level
build.gradle
file, enable thedataBinding
feature
android { ... buildFeatures { dataBinding true }}
Usage
1. Load the library in Activity/Fragment
Kotlin
MonlixOffers.Builder() .setAppId("APP_ID") .setUserId("USER_ID") .setAge(20) .setGender(MonlixGender.MALE) // MALE, FEMALE, OTHER .build(this) // context
Java
new MonlixOffers.Builder() .setAppId("APP_ID") .setUserId("USER_ID") .setAge(20) .setGender(MonlixGender.MALE) // MALE, FEMALE, OTHER .build(this) // context
2. Show the offerwall
Kotlin
MonlixOffers.showWall(this,"ZONE_ID") // Zone Id is optional
Java
MonlixOffers.INSTANCE.showWall(this,"ZONE_ID")
3. Close the offerwall
Kotlin
MonlixOffers.closeWall(this) // refers to context
Java
MonlixOffers.INSTANCE.closeWall(this)