Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

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} appSecret - The App Secret for your account.
@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) {}

Engage
function engage() {
    MappPlugin.engage("sdkKey",
                         "googleProjectId",
                         "cepURL",
                         "appID",
                         "tenantID",
                         function (json) {
                         alert(JSON.stringify(json));
                         },
                         function (json) {
                         alert(JSON.stringify(json));
                         });
} 

Check if the device is registered in Mapp

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

Alias

Set device alias

@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) {}

Example
 function setDeviceAlias() {
    
    MappPlugin.setDeviceAlias("Phonegap Alias",
                                 function (json) {
                                 alert(JSON.stringify(json));
                                 },
                                 function (json) {
                                 alert(JSON.stringify(json));
                                 });
}

Get 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.getAlias = function (successCallback, errorCallback) {}

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

Remove alias

Remove the alias 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.removeDeviceAlias = function (successCallback, errorCallback) {}

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

Device API 

Device Information

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) {}

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

Get Rich Messages

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) {}

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

Delete Messages (iOS only)

Delete a Rich Message.
@param {string} msgID - A string representing the message ID.
@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) {}

Example
 function deleteRichMessage() {
    
    MappPlugin.deleteRichMessage("0",
                                    function (json) {
                                    alert(JSON.stringify(json));
                                    },
                                    function (json) {
                                    alert(JSON.stringify(json));
                                    });
}

Refresh Inbox (iOS only)

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) {}

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

Push API

Push Enabled

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) {}

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

Disable Push

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) {}

Example
 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) {}

Example
 function setDateField() {
    
    MappPlugin.setDateField("myDateKey",
                               "2015-03-16 00:00:00",
                               function (json) {
                               alert(JSON.stringify(json));
                               },
                               function (json) {
                               alert(JSON.stringify(json));
                               });
}

Set Numeric Field

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) {}

Example
 function setNumericField() {
    
    MappPlugin.setNumericField("myNumericKey",
                                  "2133",
                                  function (json) {
                                  alert(JSON.stringify(json));
                                  },
                                  function (json) {
                                  alert(JSON.stringify(json));
                                  });
}

Set String Field

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) {}

Example
 function setStringField() {
    
    MappPlugin.setStringField("myStringKey",
                                 "some string value",
                                 function (json) {
                                 alert(JSON.stringify(json));
                                 },
                                 function (json) {
                                 alert(JSON.stringify(json));
                                 });
}

Get Custom Field

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) {}

Example
 function fetchCustomFieldByKey() {
    
    MappPlugin.fetchCustomFieldByKey("myStringKey",
                                        function (json) {
                                        alert(JSON.stringify(json));
                                        },
                                        function (json) {
                                        alert(JSON.stringify(json));
                                        });
}

Notifications

Get Last Push 

Get last push payload. This method will only return the payload once.

@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.getLastPushPayload = function (successCallback, errorCallback) {}

Example
function getLastPushPayload() {

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

Badge Number (iOS Only)

Method sets the application badge number on iOS only, and only if notifications are approved.
@param {string} badgeNumber - a string with a value of an Integer, to set as the application badge number.
@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.setApplicationBadgeNumber = function (badgeNumber, successCallback, errorCallback){}

Set badge
function setApplicationBadgeToZero() {

	    MappPlugin.setApplicationBadgeNumber("0", // Pass the Badge number you want the application icon to present.
                                           function (json) {
                                           alert(JSON.stringify(json));
                                           },
                                           function (json) {
                                           alert(JSON.stringify(json));
                                           });
}

Show Notifications on Foreground (iOS10 Only)

Method will show / hide notification when app is in foreground. Default is false. Available for ios10 and above.
@param {string} show - 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.showNotificationsOnForeground = function (show, successCallback, errorCallback){}

Show Notifications On Foreground iOS10
function showNotificationOnForeground() {
	
	    MappPlugin.showNotificationsOnForeground("true", // Pass 'true' or 'false' to indicate if notifications should be displayed on foreground.
                                           function (json) {
                                           alert(JSON.stringify(json));
                                           },
                                           function (json) {
                                           alert(JSON.stringify(json));
                                           });
}

Rich Received (iOS Only)

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) {}

Example
 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.

Example
function setOnPushMessageListener() {


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

Show In-App message (iOS Only)


Method to trigger In-App message. 

@param {string} appId - specific ID for the application.

@param{string} tenantId -  tenant ID for our system which is provided by our account management.

@param{string} userId - ID from our Engage system which is provided by our account management.

@param{string} deviceId - UDID from the device.

@param{string} jamieUrl - specific url that is also provided by our account management.

@param{string} alias -  A string to be identified as the device alias

@param{string} eventName - specific Engage event trigger.

@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.

MappInappPlugin.prototype.fireInappEventfunction (appId, tenantId, userId, deviceId, jamieUrl, alias, eventName, successCallback, errorCallback){}

Example
function fireInAppEvent() {


    MappInappPlugin.fireInAppEvent("appId",
									"tenantId",
									"userId",
									"deviceId",
									"jamieUrl",
									"alias",
									"eventName",
        							function (json) {
           						    alert(JSON.stringify(json));
       								 },
        							function (json) {
          						    alert(JSON.stringify(json));
     							    });
 }

Show In-App message (iOS Only)

Method to trigger an In-App message.

@param{string} name - string which describes the event name, Engage event trigger.

@param{string} attributes - a string which contains Plist objects with any additional data.

@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.

MappInappPlugin.prototype.reportInteractionEventWithNameAndAttributes = function (name, attributes, successCallback, errorCallback){}


Example
function reportInteractionEventWithNameAndAttributes(){


    MappInappPlugin.reportInteractionEventWithNameAndAttributes("name",
																"attributes",
        															function (json) {
            														alert(JSON.stringify(json));
       																 },
        															function (json) {
            														alert(JSON.stringify(json));
        															});
}

Fetch inbox messages(iOS only)


The method fetches all inbox In-App messages.

@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.

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


Example
function fetchInboxMessages() {


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

Show In-App message (Android Only)

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

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

Example
function fireInAppEvent() {


    MappPlugin.fireInAppEvent("app_open",
        function (json) {
            alert(JSON.stringify(json));
        },
        function (json) {
            alert(JSON.stringify(json));
        });
}

onActionListener (Android Only)

The method is called when an In-App message is clicked or deep-link push is received.
@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.setApplicationBadgeNumber = function (badgeNumber, successCallback, errorCallback){}

 

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

Remove Badge Number (Android only)

Method to erase badge number.
@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.removeBadgeNumber = function (successCallback, errorCallback){}

Set badge
function removeBadgeNumber() {


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

 

 

 

  • No labels