Integrate Flutter SDK - Android
This document will cover SDK installation and initialization steps for your Flutter Android application
Installation
Open your Flutter project’s pubspec.yaml file
Add following line of code inside dependencies in pubspec.yaml file
Run flutter pub get in the terminal
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
Initialization
Initialize Suprsend Flutter SDK
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:
Replace WORKSPACE KEY
and WORKSPACE SECRET
with values linked to your account. You’ll find it on SuprSend dashboard (Developers -> API keys) page.
Import SuprSend SDK in your client side code
Import suprsend SDK in your dart file. Go back to the flutter folder and follow below steps:
Logging
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.