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)

.setLogLevel

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

FlareLane.setLogLevel(level: .verbose)

Subscription

.isSubscribed()

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

FlareLane.isSubscribed { isSubscribed in
  // Do Something...
}

.subscribe()

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

FlareLane.subscribe(fallbackToSettings: true) { isSubscribed in
  // Do Something...
}

.unsubscribe()

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

FlareLane.unsubscribe() { isSubscribed in
  // 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)

.trackEvent

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

FlareLane.trackEvent("test_event")
// OR
FlareLane.trackEvent("test_event", data: ["test":"value"])

.setTags

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

FlareLane.setTags(tags: ["gender": "men", "age": 24])

.getDeviceId

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

.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()
}

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")

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

Last updated