Marigold Engage-Flutter (flutterselligent)
This module provides an API for the usage of the Marigold Engage Mobile SDKs in Flutter.
Marigold Engage-Flutter Integration
This module supports the following SDK and tools:
SDK | Version |
---|---|
Android SDK | 4.7.0 |
iOS SDK | 3.8.6 |
Flutter | 3.3.0 |
Flutter SDK | 3.7.0 |
Installation
Please refer to our SDK full documentation for a step-by-step guide on how to use the SDK, after installation.
-
Run this command with Flutter
flutter pub add flutterselligent
Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.
To update to a newer version, you can run the following command
flutter pub upgrade
-
Create a
selligent.json
file (name is case sensitive) in the root of the Flutter project (you can alternatively place it inside another folder or inside aselligent
folder which will automatically be checked by the wrapper) with the following content:{ "url": "someMobilePushUrl", "clientId": "someClientId", "privateKey": "somePrivateKey", "fullyQualifiedNotificationActivityClassName": "com.some.project.MainActivity", "appGroupId": "group.yourgroupname", "enableiOSLogging": 56, "enableAndroidLogging": true }
Check all the options that can be used in our SDK full documentation
iOS Specific installation
-
Drag and drop the
selligent.json
you created (or the full folder(s) containing it) to the Xcode project inside theCopy Bundle Resources
inBuild phases
of your target:Do not check the "copy if needed" option to make sure you only have to manage one selligent.json file
-
Start the SDK in the
AppDelegate
import Flutter import UIKit import FlutterSelligentMobileSDK @main @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { GeneratedPluginRegistrant.register(with: self) FlutterSelligent.configureWithLaunchOptions(launchOptions ?? [:]) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } }
Android Specific installation
-
Create a Google application following the section Creating a Google application of the Android - Using the SDK pdf, and place the
google-services.json
file in theandroid/app
folder. -
Add the following in the
android/build.gradle.kts
file:buildscript { repositories { google() mavenCentral() } dependencies { classpath("com.google.gms:google-services:4.4.0") } }
-
Add the following in the
android/app/build.gradle.kts
file (at the bottom):apply(plugin = "com.google.gms.google-services")
-
Create a
MainApplication.kt
file next to theMainActivity.kt
and configure the SDK (make sure theandroid:name
in theAndroidManifest.xml
points to.MainApplication
):import android.app.Application; import com.selligent.flutterselligent.FlutterselligentPlugin import android.util.Log; class MainApplication : Application() { override fun onCreate() { super.onCreate() FlutterselligentPlugin.configure(this) } }
-
Enable
Buildconfig
in thegradle.properties
at project level:android.defaults.buildfeatures.buildconfig=true