Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Implement the plugin

...

Implement the plugin

Call this method as soon as possible in your app initialization process to register the device and receive a push.
The method must be called on every app launch.
Notification methods (pushMessageReceived, richMessageReceived) are only available after this method is called.
@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 use for engagement, this info will be provided by account managers.
@param {string} tenantID - The ID which recognise you at the Mapp Engage system, will be also provided by account managers.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.

MappPlugin.prototype.engage = function (sdkID, appSecret, successCallback, errorCallback) {}

...

Returns "true" if registration is completed, "false" if failed or not yet completed.
MappPlugin.prototype.isReady = function (successCallback, errorCallback)

...

@param {string} alias - A string to be identified as the device alias.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
MappPlugin.prototype.setDeviceAlias = function (alias, successCallback, errorCallback) {}

...

@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
MappPlugin.prototype.getAlias = function (successCallback, errorCallback) {}

...

Remove the alias associated with this device. Empty string is need to be sent as an alias, because Engage system does not support NULL as an alias value. 
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
MappPlugin.prototype.removeDeviceAlias = function (successCallback, errorCallback) {}

...

Get information associated with this device.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
MappPlugin.prototype.deviceInformation = function (successCallback, errorCallback) {}

...

Get rich messages for this device.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
MappPlugin.prototype.getRichMessages = function (successCallback, errorCallback) {}

...

Delete a Rich Message.
@param {string} msgID - A string representing the message ID. Message ID's can be retrieved in MappPlugin.refreshInbox()
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
MappPlugin.prototype.deleteRichMessage = function (msgID, successCallback, errorCallback) {}

...

Sync inbox messages with Mapp servers.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
MappPlugin.prototype.refreshInbox = function (successCallback, errorCallback) {}

...

Check if the feature is enabled.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
MappPlugin.prototype.isPushEnabled = function (successCallback, errorCallback) {}

...

Method will disable / enable the feature.
@param {string} disable - a string with a value of "true" or "false".
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
MappPlugin.prototype.disablePushNotifications = function (disable, successCallback, errorCallback) {}

Code Block
languagejs
titleExample
 function disablePushNotifications() {
    
    MappPlugin.disablePushNotifications("true",
                                           function (json) {
                                           alert(JSON.stringify(json));
                                           },
                                           function (json) {
                                           alert(JSON.stringify(json));
                                           });
}

Custom Fields API

Set Date Field

Set a date value for a key.
@param {string} key - A key to be paired with the value.
@param {string} value - A value which conforms 'yyyy-MM-dd hh:mm:ss'.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
MappPlugin.prototype.setDateField = function (key, value, successCallback, errorCallback) {}

...

Set a number value for a key.
@param {string} key - A key to be paired with the value.
@param {string} value - A value which contains a number, i.e. "34", "34.54".
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
MappPlugin.prototype.setNumericField = function (key, value, successCallback, errorCallback) {}

...

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.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
MappPlugin.prototype.setStringField = function (key, value, successCallback, errorCallback) {}

...

Get a key-value pair for a given key.
@param {string} key - A key paired with a value.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
MappPlugin.prototype.fetchCustomFieldByKey = function (key, successCallback, errorCallback) {}

...

MappPlugin.prototype.getLastPushPayload = function (successCallback, errorCallback) {}

...

MappPlugin.prototype.setApplicationBadgeNumber = function (badgeNumber, successCallback, errorCallback){}

...

MappPlugin.prototype.showNotificationsOnForeground = function (show, successCallback, errorCallback){}

...

Method is called when a rich message is received.
@param {string} jsonArg - A json string with the rich message payload.
MappPlugin.prototype.richMessageReceived = function richMessageReceived(jsonArg) {}

Code Block
languagejs
titleExample
 MappPlugin.prototype.richMessageReceived = function richMessageReceived(jsonArg) {
      alert("Rich Message:\n" + jsonArg);
            
      /* Add your own implementation here. */ 
}

On Push Message Listener (Android Only)

There are 4 types of messages in messageHandlerType field onPushOpened, onPushDismissed, onSilentPush, onPushReceived 

* @callback {string} successCallback - A json string with a response for this operation with information.
* @callback {string} errorCallback - A json string with a response for this operation with information.

Code Block
languagejs
titleExample
function setOnPushMessageListener() {


    MappPlugin.setOnPushMessageListener(
        function (json) {
            alert(JSON.stringify(json));
        },
        function (json) {
            alert(JSON.stringify(json));
        });
}


Fetch inapp inbox messages


The method fetches all inbox In-App messages.

...

MappInappPlugin.prototype.fetchInboxMessages = function (successCallback, errorCallback){}

...

Code Block
languagejs
titleExample
function fetchInboxMessages() {


    MappInappPlugin.fetchInboxMessages()(
        function (json) {
            alert(JSON.stringify(json));
        },
        function (json) {
            alert(JSON.stringify(json));
        });
}

Show In-App message

The method triggers an In-App message.
@param {string} event  - specific DCM event trigger. 

MappPlugin.prototype.fireInAppEvent = function fireInAppEvent(event,successCallback,errorCallback) {}

...

MappPlugin.prototype.setApplicationBadgeNumber = function (badgeNumber, successCallback, errorCallback){}

...

MappPlugin.prototype.removeBadgeNumber = function (successCallback, errorCallback){}

Code Block
titleSet badge
function removeBadgeNumber() {
    MappPlugin.removeBadgeNumber(
        function (json) {
            alert(JSON.stringify(json));
        },
        function (json) {
            alert(JSON.stringify(json));
        });
}


Location API  (will be implement soon for Android)

Start location monitoring

Location manager will be enabled and it will collect the location change events.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
MappPlugin.prototype.startGeo = function (successCallback, errorCallback) {}

Code Block
languagejs
titleExample
 function startGeoLocation() {


    MappPlugin.startGeo(
        function (json) {
            alert(JSON.stringify(json));
        },
        function (json) {
            alert(JSON.stringify(json));
        });
}


Stop location monitoring

Location manager will be disabled.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
MappPlugin.prototype.stopGeo = function (successCallback, errorCallback) {}

Code Block
languagejs
titleExample
function stopGeoLocation() {


    MappPlugin.stopGeo(
        function (json) {
            alert(JSON.stringify(json));
        },
        function (json) {
            alert(JSON.stringify(json));
        });
}

...