Integrate Flutter SDK - Android

This document will cover SDK installation and initialization steps for your Android application


Step 1: Open your Flutter project’s pubspec.yaml file

Add following line of code inside dependencies in pubspec.yaml file

  	sdk: flutter
  suprsend_flutter_sdk: "^2.1.0"

Step 2: Run flutter pub get in the terminal

flutter pub get


Troubleshooting notes

In case you face compilation errors or warnings, please perform the following troubleshooting steps:

  • Ensure mavenCentral is present under repositories in project's build.gradle
  • Perform gradle sync


Step 1: To integrate SuprSend in your Android app, you will need to initialize the suprsend flutter sdk in your MainApplication class.

Note: SSApi.init should only be called in Application class, not inside Activity class ie.. MainActivity.kt. If your project does not have an Application class, you'll have to create it manually and register it in the AndroidManifest.

Example: If you create a new Application class called MainApplication.kt in your source package, go to your AndroidManifest file and enter the path of the class in the tag like this:

import app.suprsend.SSApi; // import sdk

class MainApplication : Application(){
  override fun onCreate() {
   SSApi.init(this, WORKSPACE KEY, WORKSPACE SECRET) // Important! without this, SDK will not work
   SSApi.initXiaomi(this, xiaomi_app_id, xiaomi_api_key) // Optional. Add this if you want to support Xiaomi notifications framework

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'.

Step 2: Import SuprSend SDK in your client side code

To call suprsend events, you'll need to import suprsend SDK in your dart file
Go back to the flutter folder and follow below steps:

import 'package:suprsend_flutter_sdk/suprsend.dart';


By default the logs of SuprSend SDK are disabled. We recommend you to enable the SDK logs by setting its value to VERBOSE. You can enable the logs just in debug mode while in development by below condition.