Skip to content

Quick Start

Getting started with SendMan is fast and easy.
We've made the integration process accessible to both experienced developers who have implemented push notifications in mobile apps before and developers who are doing it for the first time.

Step 1: Install the SDK

SendMan is installed via Gradle . The SDK can be installed through jCenter .

In order to install it, you should modify both your top-level and your app's module build.gradle files.

repositories {
    google()
    jcenter()
}

dependencies {
    classpath 'com.android.tools.build:gradle:4.0.1'
    classpath 'com.google.gms:google-services:4.3.3' 
}

The highlighted rows ensure you have Google's dependencies used by Firebase for sending FCM notifications to Android devices.

apply plugin: 'com.google.gms.google-services'

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    // Other libraries you use

    implementation 'io.sendman.sdk:sendman:1.0.0'
}
The first line applies the plugin required for FCM to function on Android devices.
The second line installs the latest version of our SDK.

Done

Having modified both build.gradle files you should now Sync your project.

Step 2: Integrate with Firebase

SendMan uses the standard way to deliver notifications to Android devices - Firebase Cloud Messaging (FCM).
Aside from the previously mentioned installation of Google's dependencies, you need to generate a google-services.json file for your app.

Head to Firebase Console to create your app by clicking Add Project and following the walkthrough.
This step is mandatory for sending push notifications to any Android device.

Going through the walkthrough when creating a project, you should download the google-services.json and place it in your app module, adjacent to the build.gradle which applies the com.google.gms.google-services plugin.

Step 3: Integrate with Your Code

SendMan has several requirements in order to fully function:

  1. Initializing the SDK: In order to communicate with our servers, you must identify the app (with a common config for all running app instances), and the individual user (in order to track and target different end users using SendMan).

    // Step 1: App-level identification: Initialize our SDK.
    SendMan.setAppConfig(SendManConfig(appKey, appSecret))
    
    // Step 2: User-level identification: Identify your users with the unique ID your application uses to identify users.
    SendMan.setUserId("some-unique-id")
    
    // Step 1: App-level identification: Initialize our SDK.
    SendMan.setAppConfig(new SendManConfig(appKey, appSecret));
    
    // Step 2: User-level identification: Identify your users with the unique ID your application uses to identify users.
    SendMan.setUserId("some-unique-id");
    

    Info

    You should call these methods as soon as possible (not necessarily together); the SDK will start sending data to our servers only after they are set.

    If your users do not have unique IDs, use this syntax for us to automatically handle those users for you:

    SendMan.setAppConfig(SendManConfig(appKey, appSecret, true))
    
    SendMan.setAppConfig(new SendManConfig(appKey, appSecret, true));
    

    Attention

    Never use autoGenerateUsers and setUserId on the same app. In this case, SendMan will ignore your userId.
  2. Registering with the Android lifecycle: Calling onCreate will make SendMan subscribe to token registration so that our servers will be able to identify the end users in order to send them notifications.

    class YourApplication: Application() {
        override fun onCreate() {
            super.onCreate()
            SendMan.onCreate(this)
        }
    }
    
    public class YourApplication extends Application {
        @Override
        public void onCreate() {
            super.onCreate();
            SendMan.onCreate(this);
        }
    }
    

    In addition to the critical token handling logic, this call will allow us to connect to your app's lifecycle to monitor the way your users interact with notifications.

Optional Configurations

On top of these required integration steps, SendMan helps you customize the look and feel of your notifications, lets you enrich the data tracked about your users, and enables your users to manage their own preferences.
You can read about these additional steps here:

  1. Customize notification icon
  2. Track custom properties about your users
  3. Add a custom view for notification management by your end users

Finish Configuration

This concludes the integration on your app's end.
In order to make everything work, you should now head to our console and configure your app as described in this 'Add Application' section.