Integrate Java SDK

This document will cover SDK installation and initialization steps

You can follow the steps mentioned in the documentation below or refer to our quick code recipe


Installation

For SDK installation, you'll have to add the SuprSend jar file. You can include the jar using following two ways:

Option 1. As a Maven dependency for maven projects from downloaded jar

suprsend-java-sdk is present as a maven dependency on maven central. Add following code to your pom.xml to include the sdk

<dependencies>
  <dependency>
    <groupId>com.suprsend</groupId>
    <artifactId>suprsend-java-sdk</artifactId>
    <version>0.5.0</version>
  </dependency>
</dependencies>

Option 2. As a jar file for non maven projects

Click here to download the latest version of java SDK from releases section and add it as an External Jar in your build path. suprsend-java-sdk is available as a JAR with name - suprsend-java-sdk-0.5.0-jar-with-dependencies.jar


👍

JDK version 8 and above is supported

Please check your Java development kit version. If it is lower than supported version, upgrade it to the latest version


Initialization

For initializing SDK, you need WORKSPACE KEY and WORKSPACE SECRET.

import suprsend.Suprsend;
Suprsend suprsend = new Suprsend("WORKSPACE KEY", "WORKSPACE KEY");

Replace WORKSPACE KEY and WORKSPACE SECRET with your workspace values. You will get both the tokens from Suprsend dashboard (Settings page -> "API keys" section). For more details, check the documentation on 'Workspaces'.


Constructor to test SDK in debug mode

Constructor which allows you to view HTTP calls to Suprsend in your console. The final parameter is a boolean parameter which denotes whether value for "debug" is true or false. Default value for the same is false.

import suprsend.Suprsend;
Suprsend suprsend = new Suprsend("WORKSPACE KEY", "WORKSPACE KEY", true);