BrazeActivityLifecycleCallbackListener

open class BrazeActivityLifecycleCallbackListener @JvmOverloads constructor(sessionHandlingEnabled: Boolean = true, registerInAppMessageManager: Boolean = true, inAppMessagingRegistrationBlocklist: Set<Class<*>?>? = emptySet<Class<*>>(), sessionHandlingBlocklist: Set<Class<*>?>? = emptySet<Class<*>>()) : Application.ActivityLifecycleCallbacks

Can be used to automatically handle Braze lifecycle methods. Optionally, openSession() and closeSession() are called on onActivityStarted and onActivityStopped respectively. The InAppMessageManager methods of registerInAppMessageManager() and unregisterInAppMessageManager() can be optionally called here as well. Note: This callback should not be set in any Activity. It must be set in the Application class of your app.

Parameters

sessionHandlingEnabled

When true, handles calling openSession and closeSession in onActivityStarted and onActivityStopped respectively.

registerInAppMessageManager
inAppMessagingRegistrationBlocklist

A set of Activitys for which in-app message registration will not occur. Each class should be retrieved via Activity.getClass. If null, an empty set is used instead.

sessionHandlingBlocklist

A set of Activitys for which session handling will not occur. Each class should be retrieved via Activity.getClass. If null, an empty set is used instead.

Constructors

Link copied to clipboard
fun BrazeActivityLifecycleCallbackListener(inAppMessagingRegistrationBlocklist: Set<Class<*>?>?, sessionHandlingBlocklist: Set<Class<*>?>? = emptySet<Class<*>>())

Constructor that sets a blocklist for session handling and BrazeInAppMessageManager registration while also enabling both features.

Link copied to clipboard
fun BrazeActivityLifecycleCallbackListener(sessionHandlingEnabled: Boolean = true, registerInAppMessageManager: Boolean = true, inAppMessagingRegistrationBlocklist: Set<Class<*>?>? = emptySet<Class<*>>(), sessionHandlingBlocklist: Set<Class<*>?>? = emptySet<Class<*>>())

Functions

Link copied to clipboard
open override fun onActivityCreated(activity: Activity, bundle: Bundle?)
Link copied to clipboard
open override fun onActivityDestroyed(activity: Activity)
Link copied to clipboard
open override fun onActivityPaused(activity: Activity)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun onActivityResumed(activity: Activity)
Link copied to clipboard
open override fun onActivitySaveInstanceState(activity: Activity, bundle: Bundle)
Link copied to clipboard
open override fun onActivityStarted(activity: Activity)
Link copied to clipboard
open override fun onActivityStopped(activity: Activity)
Link copied to clipboard

Registers this listener directly against the Application. Equivalent to:

Link copied to clipboard

Sets the Activity.getClass blocklist for which in-app message registration will not occur.

Link copied to clipboard

Sets the Activity.getClass blocklist for which session handling will not occur.

Link copied to clipboard
fun shouldHandleLifecycleMethodsInActivity(activity: Activity, forSessionHandling: Boolean): Boolean

Determines if this Activity should be ignored for the purposes of session tracking or in-app message registration.