ForeSee Developer Portal

Everything you need to set up and optimize your ForeSee product. Home of developer documentation, implementation guides, and question/answer forums.

Blueprint

Getting Started

This guide explains the functionality provided by the ForeSee for Android Software Development Kit (SDK) and shares information on the concepts this SDK leverages. This SDK includes functionality for both ForeSee’s base trigger library and Replay.

Basic invite

Basic invite

To add the SDK remotely using Gradle:

Add the following code to your build.gradle file(s):

allprojects {
    repositories {
        jcenter()
    }
}

dependencies {
    compile 'com.foresee.sdk:sdk:+'
}

Instrumenting Your Code:

  1. If the application does not have a custom Application class, i.e., a class that extends android.app.Application, create one. Ensure that the AndroidManifest.xml file is updated appropriately.
  2. Add the foresee_configuration.json file to the res/raw directory (if there is no directory called raw in the resources directory, create that directory). Separate configurations can be specified on a per-locale basis by using the resource folder suffixes, eg res/raw-fr, but make sure you include a default res/raw folder as per Android requirements.
  3. Within the onCreate method of the custom Application class, initialize the ForeSee SDK by invoking ForeSee.start(this). For example, the onCreate() method might look something like the following:
@Override
public void onCreate() {
  super.onCreate();
  ForeSee.start(this);
}
  1. At the point the survey is to be displayed, invoke ForeSee.checkIfEligibleForSurvey() to perform a survey eligibility check.This is usually done on application start and would therefore be placed in the ”entry point” Activity (typically this would be the Activity with the intent filter action of android.intent.action.MAIN and intent filter category of android.intent.category.LAUNCHER).For example, this might be implemented in the onResume() method as follows:
@Override
public void onResume() {
  super.onResume();
  ForeSee.checkIfEligibleForSurvey();
}

To add the SDK locally using Gradle:

  1. Add foresee-sdk-android-4.2.5.aar to the project libs directory.
  2. Add the following lines to your build.gradle file(s):
allprojects {
    repositories {
        flatDir{
            dirs 'libs'
        }
    }
}
dependencies {
    compile (name:'foresee-sdk-android-4.2.5', ext:'aar')
    compile 'com.google.code.gson:gson:2.2.4'
}

To add the SDK remotely using Maven:

  1. Add the following to your settings.xml file:
<profiles>
    <profile>
        <repositories>
            <repository>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
                <id>bintray-foreseemobile-Android</id>
                <name>bintray</name>
                <url>http://foreseemobile.bintray.com/Android</url>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
                <id>bintray-foreseemobile-Android</id>
                <name>bintray-plugins</name>
                <url>http://foreseemobile.bintray.com/Android</url>
            </pluginRepository>
        </pluginRepositories>
        <id>bintray</id>
    </profile>
</profiles>
<activeProfiles>
    <activeProfile>bintray</activeProfile>
</activeProfiles>
<dependencies>
  <dependency>
    <groupId>com.foresee.sdk</groupId>
    <artifactId>sdk</artifactId>
    <version>4.2.5</version>
    <type>pom</type>
    </dependency>
<dependencies>

Getting Started

This guide explains the functionality provided by the ForeSee for Android Software Development Kit (SDK) and shares information on the concepts this SDK leverages. This SDK includes functionality for both ForeSee’s base trigger library and Replay.