#Methods

#init

fun init(key: String, context: Context)

Creates a new Engage instance (required to display elements) using your app ID & the current context.

#createElement

fun createElement(slug: String, target: ViewGroup): Unit

Creates an Engage Element and displays it inside a view group of your choice.

#autoCreate

fun autoCreate(filters: List<String>? = emptyList()): Unit

Creates all elements matching multiple conditions like device, country, custom filters, etc.

#commitPageView

fun commitPageView(): Engage

Increments the page view counter in the device's SharedPreferences for elements with a page view count limit.
You can also use this to base capping on sessions instead of page views:

#config

fun config(key: String, value: Any?, readOnly: Boolean? = null): Engage

fun config(options: Map<String, Any?>, readOnly: Boolean? = null): Engage

Allows to set some configuration options. See the configuration options documentation.

#texts

fun texts(key: String, value: String?, readOnly: Boolean? = null, locale: String? = null): Engage

fun texts(options: Map<String, String?>, readOnly: Boolean? = null, locale: String? = null): Engage

Allows to override some hard coded texts. See the texts documentation.

#variables

fun variable(name: String, value: Any): Engage

fun variable(options: Map<String, Any>): Engage

Allows to set custom variables to be replaced inside some text keys. See the variables documentation.

#on*

fun on*(callback: (data: Any?) -> Unit): Access

Allows you to set a callback to be called when a specific event is triggered (ex: onReady). See the events documentation.

#off

fun off(event: EngageEvents): Engage

Allows to remove a callback previously set with on*. Accepted values for event are:
  • Events.READY
  • Events.SEEN
  • Events.CLICK
  • Events.FORM_SUBMIT
  • Events.DESTROY
  • Events.ERROR