Module Integration

Lucra leverages Coilarrow-up-right to render images and SVGs. In your application class, provider the LucraCoilImageLoader

// Don't forget to set the app manifest to use this Application
class MyApplication : Application(), ImageLoaderFactory {
    // Use Lucra's ImageLoader to decode SVGs as needed
    override fun newImageLoader() = LucraCoilImageLoader.get(this)
}
circle-info

API Key Update (Required)

Starting with Android SDK 6.0.0+, Lucra SDK initialization requires a new apiKey.

Docs will be updated once this version is available

What changed

  • A new apiKey is required during Lucra SDK initialization.

  • The previous apiKey + apiUrl initialization pattern is no longer supported.

  • Existing integrations on older SDK versions continue to function as-is.

Required action

  • Update your Lucra SDK initialization to pass the new apiKey at runtime.

  • Remove prior apiUrl reference.

Notes

  • The apiKey used prior to this version will not work once this latest version is adopted.

  • Please reach out to Lucra to obtain your new Sandbox and Production keys.

  • Backend API keys are unchanged.

Use the getLucraFlowDeeplinkUri to turn the Lucra Uri into a flow you can launch.

Deeplinks must be initialized to create Games You Play contests and to be able to share Sports You Watch contests with other users.

To initialize deeplinks, you must set the Deeplink Transformer.

Anytime a deeplink is generated within the Lucra SDK (ex: sharing a contest), the setDeeplinkTransformerfunction will be called. originalUri is a String the Lucra SDK generates internally which contains Lucra-specific data associated with the action. This String will be parsed at a later date when the recipient opens the deeplink.

The lamda associated with setDeeplinkTranformer must return a String. Within this lamda, you will transform the originalUri into a deeplink your app understands using your existing deeplinking system (ex: AppsFlyer, Firebase, custom logic, etc). The Lucra SDK will then provide your deeplink URL to the end user for them to share.

When a deeplink is received by a user, you must parse the Lucra-specific Uri before passing it into the SDK.

Use the getLucraFlowDeeplinkUri to turn the Lucra Uri into a flow you can launch.

Initializing Notifications

Lucra's push notification works with your existing Firebase push notification solution.

refreshFirebaseToken

Pass in the unique device token that's generated by Firebase.

The Firebase token can also be retrieved from your Activity via...

handlePushNotification

This function will return true if the incoming push notification is Lucra-specific. The Lucra SDK will consume and display the notification to the user.

  • Parameters:

    • context: Context Context of the Service.

    • remoteMessage: RemoteMessage The push notification data from Firebase.

    • activityClass: Class<*> The Java class of the Activity that you want the push notification to open after a click.

    • smallIcon: Int The drawable resource id of the icon you want to display next to the Lucra notification.

Handling Lucra push notification click events

Within the activityClass Activity that you specified above, handle the incoming Intent and parse the Lucra-specific notification to show a LucraFlow. Add handleNotificationIntent to the following locations.

onNewIntent contains the notification data when the Android app is in the background and the notification is clicked.

onCreate contains the notification data when the app is dead and the notification is clicked

Interacting with APIs

Use Lucra instance easily by invoking the class operator LucraClient().* or fetching the instance LucraClient.getInstance().*

Once you have the instance, you can interact with our SDK interfaces.

Last updated