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
  • .initialize
  • .setLogLevel
  • Subscription
  • .isSubscribed()
  • .subscribe()
  • .unsubscribe()
  • Data Management
  • .setUserID
  • .trackEvent
  • .setTags
  • .getDeviceId
  • Notifications Handler
  • .setNotificationClickedHandler
  • .setNotificationForegroundReceivedHandler
  • In-App Message
  • .displayInApp
  • .setInAppMessageActionHandler
  1. Guide for Developers

Mobile SDK Reference

.initialize

Request the notification permission and register a subscribed device.

/*
  Params
  - launchOptions: [UIApplication.LaunchOptionsKey : Any]?
  - projectId: String
  - requestPermissionOnLaunch: Bool = true

*/

FlareLane.initWithLaunchOptions(launchOptions, projectId: "INPUT_YOUR_PROJECT_ID", true)
/*
  Params
  - launchOptions:(NSDictionary<UIApplicationLaunchOptionsKey,id> * _Nullable)
  - projectId:(NSString * _Nonnull)
  - requestPermissionOnLaunch:(Bool) = YES

*/

[FlareLane initWithLaunchOptions:launchOptions projectId:@"INPUT_YOUR_PROJECT_ID" requestPermissionOnLaunch: YES];
/*
  Params
  - Context context
  - String projectId
  - boolean requestPermissionOnLaunch

*/

FlareLane.initWithContext(this, "INPUT_YOUR_PROJECT_ID", true)
/*
  Params
  - Context context
  - String projectId
  - boolean requestPermissionOnLaunch

*/

FlareLane.initWithContext(this, "INPUT_YOUR_PROJECT_ID", true);
/*
  Params
  - String projectId
  - bool? requestPermissionOnLaunch = true

*/

FlareLane.shared.initialize("INPUT_YOUR_PROJECT_ID", requestPermissionOnLaunch: true);
/*
  Params
  - projectId: string
  - requestPermissionOnLaunch: boolean = true
*/

FlareLane.initialize('INPUT_YOUR_PROJECT_ID', true);

.setLogLevel

/*
  Params
  - LogLevel level
    - .verbose
    - .error
*/

FlareLane.setLogLevel(level: .verbose)
/*
  Params
  - LogLevel level
    - LogLevelVerbose
    - LogLevelError
*/

[FlareLane setLogLevelWithLevel:LogLevelVerbose];
/*
  Params
  - int logLevel
    - Log.VERBOSE
    - Log.ERROR
*/

FlareLane.setLogLevel(Log.VERBOSE)
/*
  Params
  - int logLevel
    - Log.VERBOSE
    - Log.ERROR
*/

FlareLane.setLogLevel(Log.VERBOSE);
/*
  Params
  - LogLevel logLevel
    - LogLevel.verbose
    - LogLevel.error
*/

FlareLane.shared.setLogLevel(LogLevel.verbose);
/*
  Params
  - logLevel: LogLevel
    - 'verbose'
    - 'error'
*/

FlareLane.setLogLevel('verbose');

Subscription

.isSubscribed()

/*
  iOS SDK >= 1.4.0
  
  Params
  - completion: @escaping (Bool) -> Void
*/

FlareLane.isSubscribed { isSubscribed in
  // Do Something...
}
/*
  iOS SDK >= 1.4.0
  
  Params
  - (void (^)(_Bool)) completion
*/

[FlareLane isSubscribedWithCompletion: ^(BOOL isSubscribed) {
  // Do Something...
}];
/*
  Android SDK >= 1.4.0

  Params
  - Context context
  Return
  - boolean isSubscribed
*/

FlareLane.isSubscribed(this)
/*
  Android SDK >= 1.4.0
  
  Params
  - Context context
  Return
  - boolean isSubscribed
*/

FlareLane.isSubscribed(this);
/*
  Flutter SDK >= 1.4.0
  
  Return
  - Future<bool> isSubscribed
  Return
  - boolean isSubscribed
*/

await FlareLane.shared.isSubscribed();
/*
  React Native SDK >= 1.4.0
  
  Params
  - callback: (isSubscribed: boolean) => void
*/

FlareLane.isSubscribed((isSubscribed) => {
  // Do Something...
});

.subscribe()

/*
  iOS SDK >= 1.4.0
  
  Params
  - fallbackToSettings: Bool - 알림 권한 띄울 수 없을 때 알림 설정으로 이동
  - completion: ((Bool) -> Void)?
*/

FlareLane.subscribe(fallbackToSettings: true) { isSubscribed in
  // Do Something...
}
/*
  iOS SDK >= 1.4.0
  
  Params
  - (BOOL) fallbackToSettings - 알림 권한 띄울 수 없을 때 알림 설정으로 이동
  - (void (^)(_Bool)) completion
*/

[FlareLane subscribeWithFallbackToSettings:YES completion:^(BOOL isSubscribed) {
  // Do Something...
}];
/*
  Android SDK >= 1.4.0
  
  Params
  - Context context
  - boolean fallbackToSettings - 알림 권한 띄울 수 없을 때 알림 설정으로 이동
  - @Nullable IsSubscribedHandler
*/

FlareLane.subscribe(this, true, FlareLane.IsSubscribedHandler {
  // Do Something...
})
/*
  Android SDK >= 1.4.0
  
  Params
  - Context context
  - boolean fallbackToSettings - 알림 권한 띄울 수 없을 때 알림 설정으로 이동
  - @Nullable IsSubscribedHandler
*/

FlareLane.subscribe(this, true, new FlareLane.IsSubscribedHandler() {
    @Override
    public void onSuccess(boolean isSubscribed) {
      // Do Something...
    }
});
/*
  Flutter SDK >= 1.4.0
  
  Params
  - bool? fallbackToSettings - 알림 권한 띄울 수 없을 때 알림 설정으로 이동
  - void Function(bool)? callback
*/

await FlareLane.shared.subscribe(true, (isSubscribed) {
  // Do Something...
});
/*
  React Native SDK >= 1.4.0
  
  Params
    - fallbackToSettings: boolean - 알림 권한 띄울 수 없을 때 알림 설정으로 이동
    - callback?: (isSubscribed: boolean) => void
*/

FlareLane.subscribe(true, (isSubscribed) => {
  // Do Something...
});

.unsubscribe()

/*
  iOS SDK >= 1.4.0
  
  Params
  - completion: ((Bool) -> Void)? = nil
*/

FlareLane.unsubscribe() { isSubscribed in
  // Do Something...
}
/*
  iOS SDK >= 1.4.0
  
  Params
  - (void (^)(_Bool)) completion
*/

[FlareLane unsubscribeWithCompletion:^(BOOL isSubscribed) {
  // Do Something...
}];
/*
  Android SDK >= 1.4.0
  
  Params
  - Context context
  - @Nullable IsSubscribedHandler
*/

FlareLane.unsubscribe(this, FlareLane.IsSubscribedHandler { 
  // Do Something...
})
/*
  Android SDK >= 1.4.0
  
  Params
  - Context context
  - @Nullable IsSubscribedHandler
*/

FlareLane.unsubscribe(this, new FlareLane.IsSubscribedHandler() {
    @Override
    public void onSuccess(boolean isSubscribed) {
      // Do Something...
    }
});
/*
  Flutter SDK >= 1.4.0
  
  Params
  - void Function(bool)? callback
*/

await FlareLane.shared.unsubscribe((isSubscribed) {
  // Do Something...
});
/*
  React Native SDK >= 1.4.0
  
  Params
  - callback?: (isSubscribed: boolean) => void
*/

FlareLane.unsubscribe((isSubscribed) => {
  // Do Something...
});

Data Management

.setUserID

When logging in, specify the user ID.

/*
  Params
  - userId: String?
*/

// SET
FlareLane.setUserId(userId: "example@flarelane.com")
// REMOVE
FlareLane.setUserId(this, nil)
/*
  Params
  - userId:(NSString * _Nullable)
*/

// SET
[FlareLane setUserIdWithUserId: @"example@flarelane.com"];
// REMOVE
[FlareLane setUserIdWithUserId: nil];
/*
  Params
  - Context context
  - @Nullable String userId
*/

// SET
FlareLane.setUserId(this, "example@flarelane.com")
// REMOVE
FlareLane.setUserId(this, null)
/*
  Params
  - Context context
  - @Nullable String userId
*/

// SET
FlareLane.setUserId(this, "example@flarelane.com");
// REMOVE
FlareLane.setUserId(this, null);
/*
  Params
  - String? userId
*/

// SET
FlareLane.shared.setUserId("example@flarelane.com");
// REMOVE
FlareLane.shared.setUserId(null);
/*
  Params
  - userId: string | null
*/

// SET
FlareLane.setUserId("example@flarelane.com");
// REMOVE
FlareLane.setUserId(null);

.trackEvent

/*
  Params
  - type: String
  - data: [String: Any]?
*/

FlareLane.trackEvent("test_event")
// OR
FlareLane.trackEvent("test_event", data: ["test":"value"])
/*
  Params
  - type: NSString
  - data: NSDictionary *Nullable
*/

[FlareLane trackEvent:@"test_event" data:nil];
// OR
[FlareLane trackEvent:@"test_event" data:@{ @"key": @"value" }];
/*
  Params
  - Context context
  - String type
  - @Nullable JSONObject data
*/

FlareLane.trackEvent(this, "test_event", null)

// OR

var tags = JSONObject()
tags.put("key", "value")

FlareLane.trackEvent(this, "test_event", tags)
/*
  Params
  - Context context
  - String type
  - @Nullable JSONObject data
*/

FlareLane.trackEvent(this, "test_event", null)

// OR

JSONObject tags = new JSONObject();
tags.put("key", "value")

FlareLane.trackEvent(this, "test_event", tags)
/*
  Params
  - type: String
  - data: Map<String, Object>?
*/

FlareLane.shared.trackEvent("test_event");
// OR
FlareLane.shared.trackEvent("test_event", {"key": "value"});
/*
  Params
  - type: string
  - data?: Record<string, string | number>
*/

FlareLane.trackEvent('test_event');
// OR
FlareLane.trackEvent("test_event", {"key": "value"});

.setTags

/*
  Params
  - tags: [String : Any]
*/

FlareLane.setTags(tags: ["gender": "men", "age": 24])
/*
  Params
  - tags:(NSDictionary<NSString *,id> * _Nonnull)
*/

[FlareLane setTagsWithTags:@{@"gender": @"men", @"age": @24}];
/*
  Params
  - Context context
  - JSONObject tags
*/

var tags = JSONObject()
tags.put("gender", "men")
tags.put("age", 24)

FlareLane.setTags(this, tags)
/*
  Params
  - Context context
  - JSONObject tags
*/

try {
    JSONObject tags = new JSONObject();
    tags.put("gender", "men");
    tags.put("age", 24);
    
    FlareLane.setTags(this, tags);
} catch (JSONException e) {
    e.printStackTrace();
}
/*
  Params
  - Map<String, Object> tags
*/

FlareLane.shared.setTags({
  "gender": "men",
  "age": 24
});
/*
  Params
  - tags: Record<string, any>
*/

FlareLane.setTags({ gender: 'men', age: 27 });

.getDeviceId

FlareLane.getDeviceId()
[FlareLane getDeviceId];
/*
  Params
  - Context context
*/

FlareLane.getDeviceId(this);
/*
  Params
  - Context context
*/

FlareLane.getDeviceId(this);
await FlareLane.shared.getDeviceId())
await FlareLane.getDeviceId()

Notifications Handler

.setNotificationClickedHandler

Register a callback handler to be executed when the app enters after clicking on the notification.

/*
  Params
  - callback: (FlareLaneNotification) -> Void
    - FlareLaneNotification
      - id: String
      - body: String
      - title: String?
      - url: String?
      - imageUrl: String?
*/

FlareLane.setNotificationClickedHandler() { notification in
  // Do Something...
}
/*
  Params
  - callback: (FlareLaneNotification) -> Void
    - FlareLaneNotification
      - id: String
      - body: String
      - title: String?
      - url: String?
      - imageUrl: String?
*/

[FlareLane setNotificationClickedHandlerWithCallback:^(FlareLaneNotification* _Nonnull notification) {
  // Do something..
}];
/*
  Params
  - public interface setNotificationClickedHandler
    - onClicked(Notification notification)
      - Notification
        - @NonNull String id
        - @Nullable String title
        - @NonNull String body
        - @Nullable String url
        - @Nullable String imageUrl
*/

FlareLane.setNotificationClickedHandler(NotificationClickedHandler { notification ->
  // Do Something...
})
/*
  Params
  - public interface NotificationClickedHandler
    - onClicked(Notification notification)
      - Notification
        - @NonNull String id
        - @Nullable String title
        - @NonNull String body
        - @Nullable String url
        - @Nullable String imageUrl
*/

 FlareLane.setNotificationClickedHandler(new NotificationClickedHandler() {
    @Override
    public void onConverted(Notification notification) {
      // Do Something...
    }
});
/*
  Params
  - NotificationClickedHandler handler = void Function(FlareLaneNotification notification);
    - FlareLaneNotification
      - String id
      - String? title
      - String body
      - String? url
      - String? imageUrl
*/

FlareLane.shared.setNotificationClickedHandler((notification) {
  // Do Something...
});
/*
  Params
  - callback: (notification: Notification) => void
    - Notification
      - id: string;
      - title?: string;
      - body: string;
      - url?: string;
*/

FlareLane.setNotificationClickedHandler((notification) => {
  // Do Something...
});

.setNotificationForegroundReceivedHandler

Register a callback handler to be executed when the app enters after clicking on the notification.

/*
  SDK Version >= 1.5.0
  
  Params
  - callback: (FlareLaneNotificationReceivedEvent) -> Void
    - FlareLaneNotificationReceivedEvent
      - notification: FlareLaneNotification
      - display()
*/

FlareLane.setNotificationForegroundReceivedHandler { event in
  print(event.notification)

  // You can display or not
  event.display()
}
/*
  SDK Version >= 1.5.0
  
  Params
  - callback: (FlareLaneNotificationReceivedEvent) -> Void
    - FlareLaneNotificationReceivedEvent
      - notification: FlareLaneNotification
      - display()
*/

[FlareLane setNotificationForegroundReceivedHandlerWithCallback:^(FlareLaneNotificationReceivedEvent * _Nonnull event) {
  NSLog([event.notification description]);

  // You can display or not
  [event display];
}];
/*
  SDK Version >= 1.5.0
  
  Params
  - public interface NotificationForegroundReceivedHandler
    - onWillDisplay(NotificationReceivedEvent event);
      - NotificationReceivedEvent
        - Notification getNotification()
        - void display()
*/

FlareLane.setNotificationForegroundReceivedHandler { event ->
  Log.d("FlareLane", event.notification.toString())
  
  // You can display or not
  event.display()
}
/*
  SDK Version >= 1.5.0
  
  Params
  - public interface NotificationForegroundReceivedHandler
    - onWillDisplay(NotificationReceivedEvent event);
      - NotificationReceivedEvent
        - Notification getNotification()
        - void display()
*/

FlareLane.setNotificationForegroundReceivedHandler((new NotificationForegroundReceivedHandler() {
  @Override
  public void onWillDisplay(NotificationReceivedEvent event) {
    Log.d("FlareLane", event.getNotification().toString());
    
    // You can display or not
    event.display();
  }
}));
/*
  SDK Version >= 1.5.0
  
  Params
  - NotificationForegroundReceivedHandler handler = void Function(FlareLaneNotificationReceivedEvent event);
    - FlareLaneNotificationReceivedEvent
      - FlareLaneNotification notification
      - display()
*/

FlareLane.shared.setNotificationForegroundReceivedHandler((event) {
  print(event.notification);

  // You can display or not
  event.display();
});
/*
  SDK Version >= 1.5.0
  
  Params
  - callback: (event: NotificationReceivedEvent) => void
    - NotificationReceivedEvent
      - notification: Notification
      - display()
*/

FlareLane.setNotificationForegroundReceivedHandler((event) => {
  console.log(event.notification);
  
  // You can display or not
  event.display();
});

In-App Message

.displayInApp

Displays the highest priority in-app message that can be shown in the group.

/*
  SDK Version >= 1.7.0
  
  Params
  - group: String
*/

FlareLane.displayInApp("home")
/*
  SDK Version >= 1.7.0
  
  Params
  - group: String
*/

[FlareLane displayInApp: @"home"];
/*
  SDK Version >= 1.7.0
  
  Params
  - String group
*/

FlareLane.displayInApp("home")
/*
  SDK Version >= 1.7.0
  
  Params
  - String group
*/

FlareLane.displayInApp("home");
/*
  SDK Version >= 1.7.0
  
  Params
  - String group
*/

FlareLane.shared.displayInApp("home");
/*
  SDK Version >= 1.7.0
  
  Params
  - group: string
*/

FlareLane.displayInApp("home");

.setInAppMessageActionHandler

Implement a handler for custom actions in the in-app message.

/*
  SDK Version >= 1.7.0
  
  Params
  - callback: (FlareLaneInAppMessage, actionId: String) -> Void
*/

FlareLane.setInAppMessageActionHandler { iam, actionId in
  // Do Something...
}
/*
  SDK Version >= 1.7.0
  
  Params
  - callback: (FlareLaneInAppMessage, actionId: String) -> Void
*/

FlareLane setInAppMessageActionHandlerWithCallback:^(FlareLaneInAppMessage * _Nonnull iam, NSString * _Nonnull actionId) {
  // Do Something...
}
/*
  SDK Version >= 1.7.0
  
  Params
  - public interface InAppMessageActionHandler
    - onExecute(InAppMessage iam, String actionId)
*/

FlareLane.setInAppMessageActionHandler(object : InAppMessageActionHandler {
  override fun onExecute(iam: InAppMessage, actionId: String) {
    // Do Something...
  }
})
/*
  SDK Version >= 1.7.0
  
  Params
  - public interface InAppMessageActionHandler
    - onExecute(InAppMessage iam, String actionId)
*/

FlareLane.setInAppMessageActionHandler(new InAppMessageActionHandler() {
  @Override
  public void onExecute(@NonNull InAppMessage iam, @NonNull String actionId) {
    // Do Something...
  }
});
/*
  SDK Version >= 1.7.0
  
  Params
  - void Function(InAppMessage iam, String actionId)
*/

FlareLane.shared.setInAppMessageActionHandler((iam, actionId) {
  // Do Something...
});
/*
  SDK Version >= 1.7.0
  
  Params
  - (iam: InAppMessage, actionId: string) => void;
*/

FlareLane.setInAppMessageActionHandler((iam, actionId) => {
  // Do Something...
});

PreviousWeb SDK SetupNextWeb SDK Reference

Last updated 8 months ago