A Cordova Plugin to access the native Salesforce Marketing Cloud MobilePush SDKs
npm install cordova-plugin-capacitor-marketingcloudsdkThis plugin is a fork of the official Marketing Cloud MobilePush SDK containing a required fix for Ionic Capacitor. This fix will be applied to the official repo starting in version 7.2.
Use this plugin to implement the Marketing Cloud MobilePush SDK for your iOS and Android applications.
Release notes for the plugin can be found here
#### 1. Add plugin to your application via npm
``shell`
cordova plugin add cordova-plugin-capacitor-marketingcloudsdk
Required for iOS
You must have Cocoapods installed for the iOS platform integration. Execute the following commands from terminal to install:
`shell`
sudo gem install cocoapods
pod repo update
#### 2. Modify your application's config.xml to configure the plugin
`xml
`
#### 3. Provide FCM credentials
To enable push support for the Android platform you will need to include the google-services.json file.
1. Download the file from your application's Firebase console and place it in your project's root folder.
2. Add following to Android element in your config.xml:
`xml`
#### 4. Enable iOS Push
Follow these instructions to enable push for iOS.
* MCCordovaPlugin
* _static_
* [.isPushEnabled(successCallback, [errorCallback])](#module_MCCordovaPlugin.isPushEnabled)
* [.enablePush([successCallback], [errorCallback])](#module_MCCordovaPlugin.enablePush)
* [.disablePush([successCallback], [errorCallback])](#module_MCCordovaPlugin.disablePush)
* [.getSystemToken(successCallback, [errorCallback])](#module_MCCordovaPlugin.getSystemToken)
* [.getAttributes(successCallback, [errorCallback])](#module_MCCordovaPlugin.getAttributes)
* [.setAttribute(key, value, [successCallback], [errorCallback])](#module_MCCordovaPlugin.setAttribute)
* [.clearAttribute(key, [successCallback], [errorCallback])](#module_MCCordovaPlugin.clearAttribute)
* [.addTag(tag, [successCallback], [errorCallback])](#module_MCCordovaPlugin.addTag)
* [.removeTag(tag, [successCallback], [errorCallback])](#module_MCCordovaPlugin.removeTag)
* [.getTags(successCallback, [errorCallback])](#module_MCCordovaPlugin.getTags)
* [.setContactKey(contactKey, [successCallback], [errorCallback])](#module_MCCordovaPlugin.setContactKey)
* [.getContactKey(successCallback, [errorCallback])](#module_MCCordovaPlugin.getContactKey)
* [.enableVerboseLogging([successCallback], [errorCallback])](#module_MCCordovaPlugin.enableVerboseLogging)
* [.disableVerboseLogging([successCallback], [errorCallback])](#module_MCCordovaPlugin.disableVerboseLogging)
* .setOnNotificationOpenedListener(notificationOpenedListener)
* .setOnUrlActionListener(urlActionListener)
* [.logSdkState([successCallback], [errorCallback])](#module_MCCordovaPlugin.logSdkState)
* _inner_
* ~notificationOpenedCallback : function
* ~urlActionCallback : function
---
Kind: static method of MCCordovaPlugin
See
- Android Docs)
- iOS Docs
| Param | Type | Description |
| --- | --- | --- |
| successCallback | function | |
| successCallback.enabled | boolean | Whether push is enabled. |
| [errorCallback] | function | |
Kind: static method of MCCordovaPlugin
See
- Android Docs)
- iOS Docs
| Param | Type |
| --- | --- |
| [successCallback] | function |
| [errorCallback] | function |
Kind: static method of MCCordovaPlugin
See
- Android Docs)
- iOS Docs
| Param | Type |
| --- | --- |
| [successCallback] | function |
| [errorCallback] | function |
Kind: static method of MCCordovaPlugin
See
- Android Docs)
- iOS Docs
| Param | Type | Description |
| --- | --- | --- |
| successCallback | function | |
| successCallback.token | string | The token used for push messaging. |
| [errorCallback] | function | |
Kind: static method of MCCordovaPlugin
See
- Android Docs)
- iOS Docs
| Param | Type | Description |
| --- | --- | --- |
| successCallback | function | |
| successCallback.attributes | Object.<string, string> | The key/value map of attributes set in the registration. |
| [errorCallback] | function | |
Kind: static method of MCCordovaPlugin
See
- Android Docs)
- iOS Docs
| Param | Type | Description |
| --- | --- | --- |
| key | string | The name of the attribute to be set in the registration. |
| value | string | The value of the key attribute to be set in the registration. |
| [successCallback] | function | |
| successCallback.saved | boolean | Whether the attribute value was set in the registration. |
| [errorCallback] | function | |
Kind: static method of MCCordovaPlugin
See
- Android Docs)
- iOS Docs
| Param | Type | Description |
| --- | --- | --- |
| key | string | The name of the attribute whose value should be cleared from the registration. |
| [successCallback] | function | |
| successCallback.saved | boolean | Whether the value of the key attribute was cleared from the registration. |
| [errorCallback] | function | |
MCCordovaPlugin - Android Docs)
- iOS Docs
| Param | Type | Description |
| --- | --- | --- |
| tag | string | The tag to be added to the list of tags in the registration. |
| [successCallback] | function | |
| successCallback.saved | boolean | Whether the value passed in for tag was saved in the registration. |
| [errorCallback] | function | |
MCCordovaPlugin - Android Docs)
- iOS Docs
| Param | Type | Description |
| --- | --- | --- |
| tag | string | The tag to be removed from the list of tags in the registration. |
| [successCallback] | function | |
| successCallback.saved | boolean | Whether the value passed in for tag was cleared from the registration. |
| [errorCallback] | function | |
Kind: static method of MCCordovaPlugin
See
- Android Docs)
- iOS Docs
| Param | Type | Description |
| --- | --- | --- |
| successCallback | function | |
| successCallback.tags | Array.<string> | The array of tags currently set in the native SDK. |
| [errorCallback] | function | |
Kind: static method of MCCordovaPlugin
See
- Android Docs)
- iOS Docs
| Param | Type | Description |
| --- | --- | --- |
| contactKey | string | The value to be set as the contact key of the device's user. |
| [successCallback] | function | |
| successCallback.saved | boolean | Whether the value passed in for contactKey` was saved in the registration. |
| [errorCallback] | function | |
Kind: static method of MCCordovaPlugin
See
- Android Docs)
- iOS Docs
| Param | Type | Description |
| --- | --- | --- |
| successCallback | function | |
| successCallback.contactKey | string | The current contact key. |
| [errorCallback] | function | |
Kind: static method of MCCordovaPlugin
See
- Android Docs)
- iOS Docs
| Param | Type |
| --- | --- |
| [successCallback] | function |
| [errorCallback] | function |
Kind: static method of MCCordovaPlugin
See
- Android Docs)
- iOS Docs
| Param | Type |
| --- | --- |
| [successCallback] | function |
| [errorCallback] | function |
MCCordovaPlugin | Param | Type |
| --- | --- |
| notificationOpenedListener | function |
| notificationOpenedListener.event | MCCordovaPlugin~notificationOpenedCallback |
MCCordovaPlugin | Param | Type |
| --- | --- |
| urlActionListener | function |
| urlActionListener.event | MCCordovaPlugin~urlActionCallback |
Kind: static method of MCCordovaPlugin
Since: 6.3.1
| Param | Type |
| --- | --- |
| [successCallback] | function |
| [errorCallback] | function |
MCCordovaPlugin | Param | Type | Description |
| --- | --- | --- |
| timeStamp | number | Time since epoch when the push message was opened. |
| values | Object | The values of the notification message. |
| values.alert | string | The alert text of the notification message. |
| [values.title] | string | The title text of the notification message. |
| [values.url] | string | The url associated with the notification message. This can be either a cloud-page url or an open-direct url. |
| values.type | string | Indicates the type of notification message. Possible values: 'cloudPage', 'openDirect' or 'other' |
MCCordovaPlugin | Param | Type | Description |
| --- | --- | --- |
| url | string | The url associated with the action taken by the user. |
---