Minimum Android SDK version - 23
- Add Flyreel maven repository to your project's
settings.gradle.kts
file:
dependencyResolutionManagement {
// ...
repositories {
// ...
maven("https://flyreelsdk.jfrog.io/artifactory/flyreel-androidsdk")
}
}
- Add the following dependency to your app's
build.gradle.kts
file:
dependencies {
// ...
implementation("lexisnexis.flyreel:android-sdk:$flyreelVersion")
}
Legacy
- Add Flyreel maven repository to your project's
build.gradle
file:
allprojects {
repositories {
// ...
maven {
url "https://flyreelsdk.jfrog.io/artifactory/flyreel-androidsdk"
}
}
}
- Add the following dependency to your app's
build.gradle
file:
dependencies {
// ...
implementation "lexisnexis.flyreel:android-sdk:$flyreelVersion"
}
To use the Flyreel SDK, you must provide a configuration with the following parameters:
settingsVersion
: Identifier of your remote SDK settings.
organizationId
: Identifier of your organization.
Then you need to call Flyreel.initalize()
method in your Application's onCreate() method. (Don't
forget to register your application class in AndroidManifest.xml)
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
val configuration = FlyreelConfiguration(
organizationId = "7d3899f1421a7650241516475",
settingsVersion = 1,
)
Flyreel.initialize(
application = this,
configuration = configuration
)
}
}
NOTE: Setting up the configuration is mandatory. Attempting to open the SDK flow without it will result in a fatal error.
Invoke openFlyreel() method with a context
Flyreel.openFlyreel(context = requireContext())
If you're launching the Flyreel flow from a deep link, push notification, or a custom solution where user details can be provided automatically, use:
fun openFlyreel(
context: Context,
zipCode: String,
accessCode: String,
shouldSkipLoginPage: Boolean = true
)
fun openFlyreel(
context: Context,
deeplinkUri: Uri? = null,
shouldSkipLoginPage: Boolean = true
)
If you want to use custom fonts in the Flyreel chat, you have two options:
- add your font ttf file to the assets folder
- add your font ttf file to the res/font folder
Then, you can use the font's name in the dashboard panel. For example, if you have added font my_font.ttf to the assets folder, you can use my_font as a font name in the Flyreel dashboard.
Enable debug logging for troubleshooting purposes:
Flyreel.enableLogs()
You can manually check Flyreel status
///This function makes a network request to retrieve the status of Flyreel for the specified zip code and access code
fun fetchFlyreelStatus(zipCode: String, accessCode: String, onSuccess: (FlyreelStatus) -> Unit, onError: (FlyreelError) -> Unit)
/// Subscribes to a stream of analytic events and handles each event with a provided callback.
///
/// This function observes a feed of analytic events from the SDK. When an event
/// is received, the provided handler callback is called with the event as its argument.
///
/// - Parameters:
/// - handler: A callback that is called with the analytic event emitted by the SDK.
/// The callback takes a single parameter:
/// - event: A `FlyreelAnalyticEvent` type that contains event's data.
Flyreel.observeAnalyticEvents { event ->
YourAnalyticProvider.send(event)
}
Verify your implementation in the sandbox mode. Initialize Flyreel with an additional parameter:
val configuration = FlyreelConfiguration(
organizationId = "7d3899f1421a7650241516475",
settingsVersion = 1,
environment = FlyreelEnvironment.Sandbox
)
Flyreel.initialize(
application = this,
configuration = configuration
)