Initializing the LucraClient
LucraClient.initialize(
// Required - provided api key to use for LucraSDK usage. One for SANDBOX and one for PRODUCTION
apiKey = "YOUR_API_KEY_HERE",
// Provide the Environment, **the `apiKey` above must match the environment specified here**.
environment = Environment.SANDBOX,
// Provide LucraUiProvider implementation from "com.lucrasports.sdk:sdk-ui:*"
// This drives the Lucra UI experience, what shows and when it shows
lucraUiProvider = LucraUi(
lucraFlowListener = object : LucraFlowListener {
// Callback for entering Lucra permitted flow launch points.
// At this point, LucraSDK is asking to display a new destination flow that you can chose to display in a different Fragment or Activity. **Return false to allow LucraSDK to show the next destination within it's own nav graph**
// NOTE: This is only called after a Flow is initially displayed
override fun launchNewLucraFlowEntryPoint(entryLucraFlow: LucraUiProvider.LucraFlow): Boolean {
Log.d("Sample", "launchNewLucraFlowEntryPoint: $entryLucraFlow")
// Here, the sample is choosing to display a new fragment.
showLucraDialogFragment(entryLucraFlow)
return true
}
//Callback for exiting all Lucra permitted flow launch points
// If `launchNewLucraFlowEntryPoint` owned the given Flow, this callback is responsible for dismissing any Dialogs or Fragments which owned it, so it follows the natural progression of Flows displaying for the user.
override fun onFlowDismissRequested(entryLucraFlow: LucraUiProvider.LucraFlow) {
Log.d("Sample", "onFlowDismissRequested: $entryLucraFlow")
supportFragmentManager.findFragmentByTag(entryLucraFlow.toString())?.let {
Log.d("Sample", "Found $entryLucraFlow as $it")
if (it is DialogFragment)
it.dismiss()
else
supportFragmentManager.beginTransaction().remove(it).commit()
} ?: run {
Log.d("Sample", "onFlowDismissRequested: $entryLucraFlow not found")
}
}
}
),
// Optionally provide Lucra.Logger implementation to track events happening through the experience
// This gives you insight into errors, non-fatals and analytics tracked throughout the experience.
customLogger = null,
// Optionally specify to output logs to Logcat, defaults to false
outputLogs = true,
// Optionally add your own color scheme and fonts, from "com.lucrasports.sdk:sdk-ui:*", defaults to the Lucra Defaults
// See more here [Theming/Appearance](1.2.1_theming.md)
clientTheme = ClientTheme(
lightColorStyle = ColorStyle(),
darkColorStyle = ColorStyle(),
fontFamily = FontFamily(
mediumFont = Font("bauziet_norm_medium.otf"),
normalFont = Font("bauziet_norm_regular.otf"),
semiBoldFont = Font("bauziet_norm_bold.otf"),
boldFont = Font("bauziet_norm_extra_bold.otf"),
)
)
)Interacting with the LucraClient asynchronously
After LucraClient is initialized
Last updated
