Below are the methods that you can use to manage the Campaign library for Cordova.
Methods
(static) error(message)
Console error reporting
Parameter
Type
Definition
message
string
Error message
(static) getAppKey(callback)
Returns the current appKey.
Parameter
Type
Definition
callback
appKeyCallback
The callback that handles the response
(static) getBadge(callback)
Parameter
Type
Definition
callback
getBadgeCallback
The callback that handles the response
(static) getPluginVersion(callback)
Parameter
Type
Definition
callback
sdkVersionCallback
The callback that handles the response
(static) getRegistrationDetails(callback)
Parameter
Type
Definition
callback
registrationDetailsCallback
The callback that handles the response
(static) getSdkVersion(callback)
Returns the current native SDK version in use.
Parameter
Type
Definition
callback
sdkVersionCallback
The callback that handles the response
(static) manualInitialization()
Manually initialize the library. It waits 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 the autoInitialize setting in CampaignConfig.json to be set to false.
(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.
(static) queueAddEvent(event, flush)
Sends an event to the Acoustic infrastructure. The status will be reported to method registered via setEventQueueCallbacks.
Parameter
Type
Definition
event
Event
The event to send to the server
flush
Boolean. Default value - true.
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.
(static) queueDeleteUserAttributes(attributes)
Removes 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.
Parameter
Type
Definition
attributes
Array
The list of attribute keys to be removed
(static) queueUpdateUserAttributes(attributes)
Updates 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.
Parameter
Type
Definition
attributes
Object
The list of attributes in key/value format
(static) safeAreaInsets(callback)
Parameter
Type
Definition
callback
Function
Retrieves a safe area for device
(static) setActionNotRegisteredCallback()
Allow Cordova developer to detect when a push action is not handled.
(static) setActionNotYetRegisteredCallback()
Lets you detect when a push action is not handled, but was previously registered.
Lets you check when attributes are sent to the server. If an 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.
Lets you check 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.
Custom Action type from the "notification-action" or the "category-actions" section of the payload
(static) setRegistrationCallback(callback)
Notifies you when a 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.
An internal function to translate timestamps from integers or strings to JavaScript date objects.
Parameter
Type
Definition
events
Array
List of events to translate
Returns an array of events.
(static) unregisterActionCallback(type)
Stop handling custom actions.
Parameter
Type
Definition
type
String
Custom Action type from the "notification-action" or the "category-actions" section of the payload
(static) userInvalidated(callback)
Queries if a user has been invalidated.
Parameter
Type
Definition
callback
Function
Retrieves the status of a user.
Type definitions
appKeyCallback(appKey)
Parameter
Type
Definition
appKey
String
A short string for identifying the app in the co.acoustic.mobilepush system
attributeQueueFailureCallback(result)
Properties supported by the result object
Property
Type
Definition
attributes
Object
Key/value pairs that were updated if the operation was set or update
domain
String
Either "channel" or "user" depending on which method was called
error
String
Description of the error
keys
Array
A list of keys that were deleted when the operation is delete
operation
String
Either "update" or "delete" depending on which method was called
attributeQueueSuccessCallback(result)
Properties supported by the result object
Property
Type
Definition
attributes
Object
Key/value pairs that were updated if the operation was set or update
domain
String
Either "channel" or "user" depending on which method was called
keys
Array
A list of keys that were deleted when the operation is delete
operation
String
Either "update" or "delete" depending on which method was called
basicFailureCallback(error)
Parameter
Type
Definition
error
String
Description of the error
categoryCallback(payload, identifier)
Parameter
Type
Definition
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
Event
Property
Type
Definition
attributes
Object
Details about the event, freeform key/value pairs
attribution
String
The campaign name associated with the event (optional)
name
String
Event name. The library automatically sends events named "sessionStart", "sessionEnd", "urlClicked", "appOpened", "phoneNumberClicked".
timestamp
Date
Indicates when the event occurred.
type
String
Event type. The library automatically sends events of "simpleNotification" and "application" types.
eventQueueFailureCallback(result)
Properties supported by the result object
Property
Type
Definition
events
Array
List of events that were sent
error
String
Description of the error
eventQueueSuccessCallback(events)
Parameter
Type
Definition
events
Array
List of events that were sent
getBadgeCallback(badgeCount)
Parameter
Type
Definition
badgeCount
Integer
The number of badges
registeredActionCallback(actionPayload, payload)
Parameter
Type
Definition
actionPayload
Object
It is normally in the format { "type": <type>, "value": <value> } but can be anything that 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"}}
Indicates if the device is registered with the Acoustic infrastructure
providerName
String
The name of a provider, e.g. "APNS" or "GCM". Lets you determine if the device has registered with the push provider's service and if it has registered with the Acoustic infrastructure.
providerRegistered
Boolean
Indicates if the device is registered with a push provider system (APNS or GCM).
Registration
Property
Type
Definition
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
userId
String
A short string identifying the user, possibly multiple devices
registrationCallback(registration)
Parameter
Type
Definition
registration
Registration
Registration details
registrationDetailsCallback(Registration)
Parameter
Type
Definition
Registration
Registration
Registration details
sdkVersionCallback(version)
Parameter
Type
Definition
version
String
A short string representing the version of the Campaign library