Acoustic MCE Cordova Plugin
- Source:
Methods
(static) append(src, addition) → {string}
This function allows filenames to be appened independently from their extensions
Parameters:
Name |
Type |
Description |
src |
string
|
Image filename eg "image.png" |
addition |
string
|
Filename addition eg "-dark" |
- Source:
Returns:
Modified filename eg "image-dark.png"
-
Type
-
string
(static) bestImage(originalSource, Function)
This function finds the best version of an image available and executes the callback when found.
Parameters:
Name |
Type |
Description |
originalSource |
string
|
Image filename eg "image.png" |
Function |
callback
|
to handle loaded image |
- Source:
(static) error(message)
Console error reporting
Parameters:
Name |
Type |
Description |
message |
string
|
Error message |
- Source:
(static) getAppKey(callback)
Allow Cordova developer to get the current appKey
Parameters:
Name |
Type |
Description |
callback |
appKeyCallback
|
The callback that handles the response |
- Source:
(static) getBadge(callback)
Allow Cordova developer to get the current badge count
Parameters:
Name |
Type |
Description |
callback |
getBadgeCallback
|
The callback that handles the response |
- Source:
(static) getPluginVersion(callback)
Allow Cordova developer to get the current native SDK version in use
Parameters:
Name |
Type |
Description |
callback |
sdkVersionCallback
|
The callback that handles the response |
- Source:
(static) getRegistrationDetails(callback)
Allow Cordova developer to get the current channelId, userId and deviceToken or registrationId
Parameters:
Name |
Type |
Description |
callback |
registrationDetailsCallback
|
The callback that handles the response |
- Source:
(static) getSdkVersion(callback)
Allow Cordova developer to get the current native SDK version in use
Parameters:
Name |
Type |
Description |
callback |
sdkVersionCallback
|
The callback that handles the response |
- Source:
(static) imageCSS(image) → {string}
This function will constrict images to their native size so @2x and @3x versions can be used in place of @1x versions.
Parameters:
Name |
Type |
Description |
image |
element
|
Image element |
- Source:
Returns:
CSS dictionary, eg {width: "100px", height: "100px"}
-
Type
-
string
(static) manualInitialization()
Manually initialize SDK, is used to wait until an event occurs before beginning
to interact with the Acoustic servers. For example, you might not want to create a
userid/channelid until after a user logs into your system. Requires
autoInitialize=FALSE MceConfig.plist flag.
- Source:
(static) phoneHome()
Executes phone home request which may update the userId and channelId to match changes made on the server. Typically used after contact merge on Engage during user identification. This allows the inbox to be synchronized between multiple installations of the application on different devices for the same user. Note, phone home will execute once every 24 hours automatically without calling this API.
- Source:
(static) queueAddEvent(event, flush)
Allow Cordova developer to send an event to the Acoustic infrastructure.
Status will be reported to method registered via setEventQueueCallbacks
Parameters:
Name |
Type |
Description |
event |
Event
|
Event to be sent to the server |
flush |
boolean
|
When this is true, the event is sent immediately and flushes the queue of events to be sent. When it is false, the event is queued and will be automatically sent when the queue is automatically flushed at a later date. This parameter is optional with the default value of true |
- Source:
(static) queueDeleteUserAttributes(attributes)
Allow Cordova developer to remove specific user attributes
This method also includes automatic retrying of failures
This method has no callbacks, but the status of the request will be sent to the JavaScript callback that was registered with setAttributeQueueCallbacks or if none were registered, it will be queued.
Parameters:
Name |
Type |
Description |
attributes |
Array
|
a list of attribute keys to be removed |
- Source:
(static) queueUpdateUserAttributes(attributes)
Allow Cordova developer to update any user attributes while leaving the existing attributes alone
This method also includes automatic retrying of failures
This method has no callbacks, but the status of the request will be sent to the JavaScript callback that was registered with setAttributeQueueCallbacks or if none were registered, it will be queued.
Parameters:
Name |
Type |
Description |
attributes |
Object
|
a list of attributes in key, value format |
- Source:
(static) replaceImages()
This function replaces named images with varients when available. For example, if a document includes a named image "logo.png" in it's HTML like this:
this function will try to load varients of that image with resolution specifications for the device @2x/@3x as well as dark and
light versions of the image. In the case of an iPhone X running iOS 13 in dark mode, this will involve trying to load "logo-dark@3x.png" and if that fails,
"logo@3x.png". If either of those succeed, the image in the HTML will be swapped.
- Source:
(static) safeAreaInsets(callback)
Get safe are insets for device.
Parameters:
Name |
Type |
Description |
callback |
function
|
to retrieve safe area for device |
- Source:
(static) scaledImage(src) → {string}
This function provides filenames for scaled images depending on the density of the screen in use.
Parameters:
Name |
Type |
Description |
src |
string
|
Image filename eg "image.png" |
- Source:
Returns:
Modified filename eg "image@2x.png"
-
Type
-
string
(static) setActionNotRegisteredCallback()
Allow Cordova developer to detect when a push action is not handled.
- Source:
(static) setActionNotYetRegisteredCallback()
Allow Cordova developer to detect when a push action is not handled, but was previously registered.
- Source:
(static) setAttributeQueueCallbacks(callback, callback)
Allow Cordova developer to know when attributes are sent to the server.
If the attribute is sent while the application is not active, the callback will be
queued until the next time this method is called to register a callback handler
Parameters:
Name |
Type |
Description |
callback |
attributeQueueSuccessCallback
|
The callback that handles the response |
callback |
attributeQueueFailureCallback
|
The callback that handles the response |
- Source:
(static) setBadge(badge)
Allow Cordova developer to set the badge count for the iOS homescreen
Parameters:
Name |
Type |
Description |
badge |
integer
|
a new badge number |
- Source:
(static) setCategoryCallbacks(callback, categoryName, actions)
Allow Cordova developer to register and respond to iOS static categories
Parameters:
Name |
Type |
Description |
callback |
categoryCallback
|
The callback that handles the response |
categoryName |
string
|
Name of category to respond to in iOS payload |
actions |
Array.<Action>
|
an array of actions |
- Source:
(static) setEventQueueCallbacks(successCallback, errorCallback)
Allow Cordova developer to know when events are sent to the server.
If the event is sent while the application is not active, the callback will be queued
until the next time this method is called to register a callback handler
Parameters:
Name |
Type |
Description |
successCallback |
eventQueueSuccessCallback
|
The callback that handles the response |
errorCallback |
eventQueueFailureCallback
|
The callback that handles the response |
- Source:
(static) setIcon(drawableName)
Allow Cordova developer to change the Android icon
Parameters:
Name |
Type |
Description |
drawableName |
string
|
Name of a drawable image in app bundle |
- Source:
(static) setRegisteredActionCallback(callback, type)
Allow Cordova developer to handle custom actions
Parameters:
Name |
Type |
Description |
callback |
registeredActionCallback
|
The callback that handles the response |
type |
string
|
Custom Action type from the "notification-action" or the "category-actions" section of the payload |
- Source:
(static) setRegistrationCallback(callback)
Allow Cordova developer to know when registration occurs.
This will only be called once when the application registers with the Acoustic servers.
If the application is not active when this happens the callback will be queued
until the next time this method is called to register a callback handler
Parameters:
Name |
Type |
Description |
callback |
registrationCallback
|
The callback that handles the response |
- Source:
(static) themedImage(src) → {string}
This function provides filenames for scaled and themed images.
Parameters:
Name |
Type |
Description |
src |
string
|
Image filename eg "image.png" |
- Source:
Returns:
Modified filename eg "image-dark@2x.png"
-
Type
-
string
(static) translateAttributes(attributes) → {Array.<Object>}
Internal function to translate a dictionary of attributes with dates into integers so they can be processed by SDK
Parameters:
Name |
Type |
Description |
attributes |
Array.<Object>
|
Attributes to be converted |
- Source:
Returns:
-
Type
-
Array.<Object>
(static) translateAttributesCallback(attributes) → {Array.<Object>}
Internal function to translate a dictionary of attributes with dates represented as integers back into JavaScript date objects
Parameters:
Name |
Type |
Description |
attributes |
Array.<Object>
|
Attributes to be converted |
- Source:
Returns:
-
Type
-
Array.<Object>
(static) translateEvents(events) → {Array.<Event>}
Internal function to translate timestamps from integers or strings to JavaScript date objects
Parameters:
Name |
Type |
Description |
events |
Array.<Event>
|
List of events to translate |
- Source:
Returns:
List of events translated
-
Type
-
Array.<Event>
(static) unregisterActionCallback(type)
Allow Cordova developer to stop handling custom actions
Parameters:
Name |
Type |
Description |
type |
string
|
Custom Action type from the "notification-action" or the "category-actions" section of the payload |
- Source:
(static) userInvalidated(callback)
Queries if user has been invalidated.
Parameters:
Name |
Type |
Description |
callback |
function
|
to retrieve status of user. |
- Source:
Type Definitions
Action
- Source:
appKeyCallback(appKey)
Parameters:
Name |
Type |
Description |
appKey |
string
|
A short string for identifying the app in co.acoustic.mobilepushs system |
- Source:
attributeQueueFailureCallback(result)
Parameters:
Name |
Type |
Description |
result |
Object
|
Properties
Name |
Type |
Description |
operation |
string
|
Either "update" or "delete" depending on which method was called |
domain |
string
|
Either "channel" or "user" depending on which method was called |
attributes |
Object
|
Key value pairs that were updated if the operation was set or update |
keys |
Array
|
A list of keys that were deleted when the operation is delete |
error |
string
|
Description of the error |
|
- Source:
attributeQueueSuccessCallback(result)
Parameters:
Name |
Type |
Description |
result |
Object
|
Properties
Name |
Type |
Description |
operation |
string
|
Either "update" or "delete" depending on which method was called |
domain |
string
|
Either "channel" or "user" depending on which method was called |
attributes |
Object
|
Key value pairs that were updated if the operation was set or update |
keys |
Array
|
A list of keys that were deleted when the operation is delete |
|
- Source:
basicFailureCallback(error)
Parameters:
Name |
Type |
Description |
error |
string
|
Description of the error |
- Source:
basicSuccessCallback()
- Source:
categoryCallback(payload, identifier)
Parameters:
Name |
Type |
Description |
payload |
Object
|
Entire Android or iOS payload for example {"aps":{"alert":"hello world", "category":"example"}} |
identifier |
string
|
String identifying button to JavaScript processing click of button |
- Source:
Event
Properties:
Name |
Type |
Description |
type |
string
|
Event type, SDK automatically sends events of "simpleNotification" and "application" types |
name |
string
|
Event name, SDK automatically sends events of "sessionStart", "sessionEnd", "urlClicked", "appOpened", "phoneNumberClicked" names |
timestamp |
Date
|
Timestamp that event occurred |
attributes |
Object
|
Details about event, freeform key value pairs |
attribution |
string
|
campaign name associated with event, optional |
- Source:
eventQueueFailureCallback(result)
Parameters:
Name |
Type |
Description |
result |
Object
|
Properties
Name |
Type |
Description |
events |
Array.<Event>
|
List of events that were sent |
error |
string
|
Description of the error |
|
- Source:
eventQueueSuccessCallback(events)
Parameters:
Name |
Type |
Description |
events |
Array.<Event>
|
List of events that were sent |
- Source:
getBadgeCallback(badgeCount)
Parameters:
Name |
Type |
Description |
badgeCount |
integer
|
|
- Source:
registeredActionCallback(actionPayload, payload)
Parameters:
Name |
Type |
Description |
actionPayload |
Object
|
is normally in the format { "type": <type>, "value": <value> } but can be whatever is sent in the "notification-action" or the "category-actions" section of the payload |
payload |
Object
|
Entire Android or iOS payload for example {"aps":{"alert":"hello world", "category":"example"}} |
- Source:
registeredCallback(providerRegistered, providerName, callback)
Parameters:
Name |
Type |
Description |
co.acoustic.mobilepushRegistered |
boolean
|
will be either true or false and represents the device registering with the Acoustic infrastructure |
providerRegistered |
boolean
|
will be either true or false and represents the device registering the push provider system (APNS or GCM) |
providerName |
string
|
name of provider, eg "APNS" or "GCM"
/**
Allow Cordova developer to determine if the device has registered with the push provider's service and if it has registered with the Acoustic infrastructure |
callback |
registeredCallback
|
The callback that handles the response |
- Source:
Registration
Properties:
Name |
Type |
Description |
userId |
string
|
A short string identifying the user, possibly multiple devices |
channelId |
string
|
A short string identifying the channel or device |
deviceToken |
string
|
A medium string that represents the iOS device on APNS |
registrationId |
string
|
A medium string that represents the Android device on GCM |
- Source:
registrationCallback(registration)
Parameters:
Name |
Type |
Description |
registration |
Registration
|
Registration Details |
- Source:
registrationDetailsCallback(Registration)
Parameters:
Name |
Type |
Description |
Registration |
Registration
|
Details |
- Source:
sdkVersionCallback(version)
Parameters:
Name |
Type |
Description |
version |
string
|
a short string representing SDK version |
- Source: