MoEHelper

open class MoEHelper

Interaction class for MoEngage SDK. Has helper methods to track events and user attributes.

Author

MoEngage (abhishek@moengage.com)

Functions

logoutUser
Link copied to clipboard
open fun logoutUser()
Invalidates the existing sessions and user attributes and treats all actions performed by the user as a new user after this method is called If the Application is doing a self registration for gcm token then invalidate the token on logout
registerActivityLifecycle
Link copied to clipboard
open fun registerActivityLifecycle(application: Application)
registerProcessLifecycleObserver
Link copied to clipboard
open fun registerProcessLifecycleObserver()
resetAppContext
Link copied to clipboard
open fun resetAppContext()
Resets the current context of the user
setAlias
Link copied to clipboard
open fun setAlias(currentId: Double)

open fun setAlias(currentId: Int)
open fun setAlias(currentId: String)
open fun setAlias(currentId: Long)
Update user's unique id which was previously set by setUniqueId
setAppStatus
Link copied to clipboard
open fun setAppStatus(status: AppStatus)
This API tells the SDK whether it is a fresh install or an existing application was updated.
setBirthDate
Link copied to clipboard
open fun setBirthDate(@NonNull birthDate: Date)
Helper method to set User BirthDate
setEmail
Link copied to clipboard
open fun setEmail(@NonNull value: String)
Helper method to set user email
setFirstName
Link copied to clipboard
open fun setFirstName(@NonNull value: String)
Helper method to set User first Name
setFullName
Link copied to clipboard
open fun setFullName(@NonNull value: String)
Helper method to set user full name
setGender
Link copied to clipboard
open fun setGender(@NonNull gender: UserGender)
Helper method to set user gender
setLastName
Link copied to clipboard
open fun setLastName(@NonNull value: String)
Helper method to set User Last Name
setNumber
Link copied to clipboard
open fun setNumber(value: String)
Helper method to set User Number
setUniqueId
Link copied to clipboard
open fun setUniqueId(value: Double)
open fun setUniqueId(value: Float)
open fun setUniqueId(value: Int)
open fun setUniqueId(@NonNull value: String)
open fun setUniqueId(value: Long)
Helper method to set User Unique Id
setUserAttribute
Link copied to clipboard
open fun setUserAttribute(@NonNull attributeMap: Map<String, Any>): MoEHelper
Set the user attributes with the attributes specified in the HashMap
open fun setUserAttribute(@NonNull name: String, @NonNull location: Location): MoEHelper
open fun setUserAttribute(@NonNull name: String, @NonNull location: GeoLocation): MoEHelper
open fun setUserAttribute(@NonNull name: String, @NonNull date: String, dateFormat: String): MoEHelper

open fun setUserAttribute(@NonNull userAttribute: String, attributeValue: Boolean): MoEHelper
open fun setUserAttribute(@NonNull userAttribute: String, attributeValue: Double): MoEHelper
open fun setUserAttribute(@NonNull userAttribute: String, attributeValue: Float): MoEHelper
open fun setUserAttribute(@NonNull userAttribute: String, attributeValue: Int): MoEHelper
open fun setUserAttribute(@NonNull userAttribute: String, attributeValue: Long): MoEHelper
Set a user attribute for the current user
open fun setUserAttribute(@NonNull userAttribute: String, @NonNull attributeValue: String): MoEHelper
Set an user attribute.
open fun setUserAttribute(@NonNull name: String, @NonNull value: Date): MoEHelper
Set a date user attribute for the current user.
setUserAttributeEpochTime
Link copied to clipboard
open fun setUserAttributeEpochTime(@NonNull userAttribute: String, attributeValue: Long): MoEHelper
Sets the given epoch time for the given user.
setUserAttributeISODate
Link copied to clipboard
open fun setUserAttributeISODate(@NonNull attributeName: String, @NonNull attributeValue: String): MoEHelper
Set a date type user attribute for the current user.
setUserLocation
Link copied to clipboard
open fun setUserLocation(lat: Double, lng: Double)
To set user location, call this method
syncInteractionDataNow
Link copied to clipboard
open fun syncInteractionDataNow()
Will request a data sync with MoEngage Platform.
trackDeviceLocale
Link copied to clipboard
open fun trackDeviceLocale()
Tracks device locale.
trackEvent
Link copied to clipboard
open fun trackEvent(@NonNull action: String, payloadBuilder: PayloadBuilder): MoEHelper
open fun trackEvent(@NonNull eventName: String, properties: Properties)
trackUserPushPreference
Link copied to clipboard
open fun trackUserPushPreference(pushPreference: Boolean)
Set push preference for the user.
unregisterLifecycleCallbacks
Link copied to clipboard
open fun unregisterLifecycleCallbacks(@NonNull application: Application)
Method to unregister lifecycle callbacks
unRegisterProcessLifecycleObserver
Link copied to clipboard
open fun unRegisterProcessLifecycleObserver()

Properties

appContext
Link copied to clipboard
private open var appContext: List<String>
application
Link copied to clipboard
private open var application: Application
instance
Link copied to clipboard
private open var instance: MoEHelper