API Reference

Prev Next

Introduction

Complete list of all public methods in the Mapp Engage React Native Plugin, grouped by function. Platform availability: Both = iOS and Android, iOS = iOS only, Android = Android only. An asterisk (*) indicates the method exists on both platforms but is a no-op on the indicated platform in the current SDK version.

Initialization & Status

MethodReturnsPlatformDescription
engage(sdkKey, googleProjectId, server, appID, tenantID)voidBothInitializes the SDK. On iOS, only server is used.
engageTestServer(cepUrl, sdkKey, googleProjectId, server, appID, tenantID)voidAndroidInitializes against a custom CEP test endpoint.
isReady()Promise<boolean>BothReturns true when the SDK is initialized.
onInitCompletedListener()Promise<void>AndroidResolves when initialization completes.
addInitListener(listener)EmitterSubscriptioniOSFires when iOS SDK initialization completes.

Device & Registration

MethodReturnsPlatformDescription
isDeviceRegistered()Promise<boolean>BothReturns true when the device is registered with Mapp.
getDeviceInfo()Promise<Object>BothReturns general device information.
getDeviceDmcInfo()Promise<any>AndroidReturns device DMC configuration from the Mapp backend. Returns null on iOS.

Push Notifications

MethodReturnsPlatformDescription
isPushEnabled()Promise<boolean>BothReturns true when push notifications are enabled.
setPushEnabled(optIn)voidBothEnables or disables push notifications.
requestPostNotificationPermission()Promise<boolean>BothRequests POST_NOTIFICATIONS permission on Android 13+. Returns true on iOS without prompting.
setPostponeNotificationRequest(postpone)voidiOSDelays the system notification permission prompt. Call before engage().
showNotificationAlertView()voidiOSTriggers the iOS notification permission dialog.
setShowNotificationsAtForeground(value)voidiOSControls notification display when the app is in the foreground.
setToken(token)Promise<boolean>BothSets the FCM registration token manually.
getToken()Promise<string>BothReturns the current FCM registration token.
setRemoteMessage(remoteMessage)voidBothForwards a Firebase remote message to the Mapp SDK for processing.
isPushFromMapp(remoteMessage)Promise<boolean>BothReturns true if the remote message originates from Mapp.
clearNotifications()voidBothClears all app notifications from the notification tray.
clearNotification(identifier)voidBothClears a specific notification by identifier.
removeBadgeNumber()voidBoth*Removes the app badge number. No-op on Android SDK v7.
addPushListener(listener)EmitterSubscriptionBothSubscribes to push notification events.
removePushListener(listener)voidBothRemoves a push notification listener.
addDeepLinkingListener(listener)EmitterSubscriptionBothSubscribes to deep link events from push notifications.
removeDeepLinkingListener(listener)voidBothRemoves a deep link listener.

GeoFencing

MethodReturnsPlatformDescription
requestGeofenceLocationPermission()Promise<boolean>BothRequests location permission required for geofencing.
startGeoFencing()Promise<string>BothStarts geofence region monitoring.
stopGeoFencing()Promise<string>BothStops geofence region monitoring.
startGeofencing()Promise<string>BothAlternative spelling of startGeoFencing(). Calls a separate native method — use startGeoFencing() unless your native setup specifically exports startGeofencing.
stopGeofencing()Promise<string>BothAlternative spelling of stopGeoFencing(). See note on startGeofencing().

In-App Messaging

MethodReturnsPlatformDescription
triggerInApp(value)voidBothTriggers an in-app message by event name.
fetchInboxMessage()Promise<any>iOSFetches inbox messages. Results delivered via addInboxMessagesListener.
fetchLatestInboxMessage()Promise<any>BothFetches the latest inbox message.
addInboxMessagesListener(listener)EmitterSubscriptioniOSReceives the full inbox message list after fetchInboxMessage().
addInboxMessageListener(listener)EmitterSubscriptioniOSReceives individual inbox message events.
addRichMessagesListener(listener)EmitterSubscriptioniOSReceives rich push message content.
inAppMarkAsRead(templateId, eventId)voidiOS*Marks an inbox message as read. No-op on Android SDK v7.
inAppMarkAsUnRead(templateId, eventId)voidiOS*Marks an inbox message as unread. No-op on Android SDK v7.
inAppMarkAsDeleted(templateId, eventId)voidiOS*Marks an inbox message as deleted. No-op on Android SDK v7.
triggerStatistic(templateId, originalEventId, trackingKey, displayMillis, reason, link)stringAndroid*Tracks an in-app message statistic. No-op in Android SDK v7.

User Data

MethodReturnsPlatformDescription
setAlias(alias, resendAttributes?)Promise<boolean>BothSets the device alias. Pass true as second argument to resend stored custom attributes to the backend.
getAlias()Promise<string>BothReturns the current device alias.
setAttributes(attributes)voidBothSets multiple custom attributes from an object.
getAttributes(keys)Promise<Object>BothReturns values for the specified attribute keys.
setAttributeString(key, value)voidBothSets a single string custom attribute.
setAttributeInt(key, value)voidBothSets a single integer custom attribute.
getAttributeStringValue(key)Promise<string>BothReturns the string value of a custom attribute.
removeAttribute(key)voidAndroidRemoves a custom attribute by key.
incrementNumericKey(key, value)voidiOSIncrements a numeric custom attribute by the given value.
addTag(tag)voidBothAdds a tag to the device.
removeTag(tag)voidBothRemoves a tag from the device.
getTags()Promise<string[]>BothReturns all tags set on the device.
addCustomEvent(event)Promise<void>BothSends a CustomEvent object to the Mapp backend.
runAction(name, value?)Promise<any>AndroidExecutes a named SDK action. Used internally by addCustomEvent().
logOut(pushEnabled)voidBothClears the user identity. Pass true to keep push active after logout.

Screen Orientation

MethodReturnsPlatformDescription
lockScreenOrientation(value)voidAndroid*Locks or unlocks screen orientation. No-op in Android SDK v7.