For convenience, you should use Mapp.js and MappEventEmmiter.js.
For the Initialization use method, this function should be first in your application :
Mapp.engage(sdkKey: string, googleProjectId: string, server: string, appID: string, tenantID: string) |
@param {string} sdkID - The SDK ID for your account.
@param {string} googleProjectID - The Google project id from your Firebase console for the chosen app.
@param {string} server - The Server, which will be used for engagement, this info will be provided by account managers.
@param {string} tenantID - The ID which recognizes you at the Mapp Engage system, will be also provided by account managers.
iOS uses most information from AppoxeeCofig.plist as explained in the integration section, so you need to have that plist set up inside iOS project.
Server list:
L3
L3_US
EMC
EMC_US
CROC
Mapp.isDeviceRegistered().then(data => { //do something with data } |
Get device alias
Mapp.getAlias().then(data => { console.log(data); Alert.alert(data) }); |
Set device alias
Mapp.setAlias(”some alias”) |
Get device info
Mapp.getDeviceInfo().then(data => { console.log(data); Alert.alert(data) }); |
Check if the feature is enabled.
Mapp.isPushEnabled().then(data => { console.log(data); Alert.alert(data.toString()) |
Disable or enable push.
Mapp.setPushEnabled(true) |
Subscribe/listen for push received events:
Mapp.addPushListener((notification) => { console.log(JSON.stringify(notification)); Alert.alert(JSON.stringify(notification)) }); |
For iOS also is an available listener for rich messages:
Mapp.addRichMessagesListener((notification) => { console.log(JSON.stringify(notification)); Alert.alert(JSON.stringify(notification)) }); |
@param{boolean} pushEnabled
- while logging out sets push the state
Mapp.logOut(pushEnabled) |
Retrieving tags:
Mapp.getTags().then(data => { Alert.alert(JSON.stringify(data)) }); |
Adding a tag:
@param{string
} tag - channel tag
Mapp.addTag("tagName"); |
Removing tag:
@param{string
} tag - channel tag
Mapp.removeTag("tagName"); |
Set a string value for a key.
@param {string} key - A key to be paired with the value.
@param {string} value - A value which contains string.
Mapp.setAttributeString("some key", "some value"); |
Set a number value for a key.
@param {string} key - A key to be paired with the value.
@param {number} value - A value which contains a number, i.e. "34", "34.54".
Mapp.setAttributeInt("some key", 34); |
Set a boolean for a key.
@param {string} key - A key to be paired with the value.
@param {boolean} value - true, false
Mapp.setAttributeBollean("some key", true); |
To get inbox messages use Mapp.fetchInboxMessage()
Mapp.fetchInboxMessage().then(data => { if (Platform.OS == "ios") { Mapp.addInboxMessagesListener( (messages) => { Alert.alert(JSON.stringify(messages)) }); } else { Alert.alert(JSON.stringify(data)) } |
iOS uses events for inbox messages (Mapp.addInboxMessagesListener
)and cannot return them as promise.
Show In-App message
The method triggers an In-App message.
@param {string} event-specific DCM event trigger.
Mapp.triggerInApp("app_open") |
Inapp messages can be marked as read, unread or deleted.
@param{number} templateId
@param{string} eventId
Mapp.inAppMarkAsRead(templateId: number, eventId: string); Mapp.inAppMarkAsUnRead(templateId: number, eventId: string); Mapp.inAppMarkAsDeleted(templateId: number, eventId: string); |
The location manager will be enabled and it will collect the location change events.
Mapp.startGeoFencing() |
The location manager will be disabled.
Mapp.stopGeoFencing() |