Android SDK

Current version: 2.3.0 (updated on: 2020-04-01)

Prerequisites

  1. Copy and save your API KEY and API SECRET
  2. Download the Wannads SDK library

Installation

Unzip the file in the location of the localMaven repository. By default, Maven local repository is defaulted to ${user.home}/.m2/repository folder:

  1. Unix/Mac OS X – ~/.m2/repository
  2. Windows – C:\Users\{your-username}\.m2\repository

When we compile a Maven project, Maven will download all the project’s dependency and plugin jars into the Maven local repository, save time for next compilation.

If the default .m2 is unable to find, maybe someone changed the default path. Issue the following command to find out where is the Maven local repository:

mvn help:evaluate -Dexpression=settings.localRepository

Example:

D:\> mvn help:evaluate -Dexpression=settings.localRepository

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-help-plugin:3.1.0:evaluate (default-cli) @ standalone-pom ---
[INFO] No artifact parameter specified, using 'org.apache.maven:standalone-pom:pom:1' as project.
[INFO]

C:\opt\maven-repository

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.598 s
[INFO] Finished at: 2018-10-24T16:44:18+08:00
[INFO] ------------------------------------------------------------------------

In above output, The Maven local repository is relocated to C:\opt\maven-repository

Add the following code to the build.grade file:

repositories {
    ...
    mavenLocal()
}

dependencies {
    ...
    implementation "com.wannads:android-sdk:2.3.0"
}

Application or Activity class (before the first usage of Wannads SDK)

public class MyActivity extends Activity {
    @Override
    public void onCreate() {
      super.onCreate();

      // Wannads SDK init
      WannadsSdk.getInstance().init(this.getApplicationContext(), YOUR_API_KEY, YOUR_API_SECRET, YOUR_USER_ID);

      // Optional parameters
      WannadsSdk.getInstance().setAge(27);
      WannadsSdk.getInstance().setGender(WanGender.MALE); // 'm' from male and 'f' for female
      // If you need to send an extra parameter you can use the SubId2.
      WannadsSdk.getInstance().setSubId2("123");

      // Customizing the offerwall
      // If you want to customize the colors of the offerwall you can include the following lines.
      // Colors can be set as a resource ID or adding the color code.

      WannadsSdk.getInstance().setPrimaryColor(R.color.wannads_primary_color);
      // or
      WannadsSdk.getInstance().setPrimaryColor("#00BEFF");

      WannadsSdk.getInstance().setConfirmButtonColor(R.color.mock_color);
    }
}

Showing offers

WannadsSdk.getInstance().showOfferWall();

Showing surveys

WannadsSdk.getInstance().showSurveysOfferWall();

Proguard

-dontwarn kotlin.coroutines.*

-keep class com.wannads.sdk.entities.** { *; }