Documentation
Website
  • Getting Started
  • Customer Journey
    • Creating a Customer Journey
    • Understanding the Journey
    • Performance Dashboard
    • Pre-built Templates
  • Cross-Channel Messages
    • Mobile Push
    • Web Push
    • In-App Message
    • SMS/LMS
    • Webhook
  • Data Integration
    • User ID
    • Events
    • Tags
    • Integrating Amplitude
    • Integrating Mixpanel
  • Audience
    • Segments
    • Device Management
  • Engagement Tools
    • Message Personalization
    • Template
  • Analytics & Insights
    • Dashboard
    • Real-time Analytics
  • Guide for Developers
    • Mobile SDK Setup
      • Android SDK Setup
      • iOS SDK Setup
      • React Native SDK Setup
      • Flutter SDK Setup
      • Additional Setup
        • Android: FCM Setup (v1)
        • Android: Notification Icons
        • iOS: APNS Setup
        • iOS: Disable Swizzling
    • Web SDK Setup
    • REST API Reference
    • Mobile SDK Reference
    • Web SDK Reference
Powered by GitBook
On this page
  • 1. Requirements
  • 2. Credentials Setup
  • 3. Install SDK
  • 4. Android Setup
  • 5. iOS Setup
  • 6. Initialization
  • 7. Test
  • 8. Identify your user
  • 9. Additional Setup
  • Android
  • Resources
  1. Guide for Developers
  2. Mobile SDK Setup

Flutter SDK Setup

PreviousReact Native SDK SetupNextAdditional Setup

Last updated 2 months ago

1. Requirements

Can be used with other push solutions!

To use FlareLane with other push solutions, you must follow some additional steps. Refer to iOS: Disable Swizzling for details.

  • to FlareLane and create a project


2. Credentials Setup

Follow this guide below:

  • Android: FCM Setup (v1)

  • iOS: APNS Setup


3. Install SDK

$ flutter pub add flarelane_flutter:1.8.0

4. Android Setup

To ensure a smooth process for obtaining permission for push notifications from users, please set compileSdkVersion to at least 33

// ...
android {
    compileSdkVersion 33
    // ...
}
// ...

5. iOS Setup

Go to Signing & Capabilities and click + Capability and add Push Notifications

To support iOS Rich Notifications, you need to add Notification Service Extension

In Xcode, select Notification Service Extension from File > New > Target

Enter the Product Name. In this guide, we will define it as FlareLaneNotificationServiceExtension.

Set Minimum Deployments of the Notification Service Extension Target you just created to be the same as the main app target you are currently using.

Add the following code to your Podfile

// Enable the Dynamic Framework
use_frameworks!

// Add the name of the extension created previously.
// In this guide, FlareLaneNotificationServiceExtension.
target 'FlareLaneNotificationServiceExtension' do
  pod 'FlareLane', '1.7.1'
end

Run pod install in the terminal

Run Xcode again and edit the extension's file. Delete the pre-filled codes and only inherit FlareLaneNotificationServiceExtension.


import FlareLane

class NotificationService: FlareLaneNotificationServiceExtension {
}

// NotificationService.h
@import FlareLane;

@interface NotificationService : FLNNotificationServiceExtension
@end

// NotificationService.m
#import "NotificationService.h"

@implementation NotificationService
@end

6. Initialization

Add the following code to main.dart. You can check your project ID at FlareLane console's Project.

import 'package:flarelane_flutter/flarelane_flutter.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  // Add the code below after WidgetsFlutterBinding.ensureInitialized()
  // To subscribe later, set the 2nd parameter to false and then run the .subscribe() later.
  FlareLane.shared.initialize("INPUT_YOUR_PROJECT_ID", requestPermissionOnLaunch: true);
  runApp(...);
}

7. Test

After completing all the steps, build and run your app. Devices that subscribe to push notifications will be automatically added to FlareLane console's All Devices.

Before actual deployment, be sure to verify that the push notifications are being received properly on the device and that the statistics are accurately recorded when the push notifications are clicked.


8. Identify your user

FlareLane's device is 'anonymous' and you can match the device with your user based on the unique user ID that identifies your user.

Usually, when a user sign-up or log-in, you should execute setUserId.

FlareLane.shared.setUserId("USER_ID");

9. Additional Setup

Android

To set a accent color or channel name, add the following lines:

<resources>
    <!-- accent color  -->
    <string name="flarelane_notification_accent_color">#BC0000</string>
    <!-- channel name -->
    <string name="flarelane_default_channel_name">All Notifications</string>
</resources>

To customize notification icons, see below:

  • Android: Notification Icons

  • Data Integration


Resources

Mobile SDK Reference

Setting up has many benefits. You can distinguish whether a user has signed-up, and push notifications can be sent based on the User ID.

To use Journeys or , integrate custom data via SDK or API:

Sign up
User ID
Message Personalization