sfmc 8.1.0
sfmc: ^8.1.0 copied to clipboard
Flutter Plugin to access the native Salesforce Marketing Cloud MobilePush SDKs.
Salesforce Marketing Cloud SDK for Flutter #
This module enables the integration of the Marketing Cloud Push SDK into your Flutter applications.
Release Notes #
For release notes, please refer to CHANGELOG.md.
Requirements #
Flutter #
- Flutter version
3.3.0+
iOS #
- minimum deployment target
iOS 12+
Android #
- minSdkVersion
21+ - compileSdkVersion
34+
Installation #
To add the plugin to your application via pub, run the following command:
flutter pub add sfmc
Example Implementation #
An example implementation is provided within the plugin. For setup details, see the example app.
Android Setup #
Please follow detailed step by step guide to setup Android Platform.
iOS Setup #
Please follow detailed step by step guide for Swift or Objective-C to setup iOS Platform.
URL Handling #
To handle URLs from push notifications, please follow iOS step by step guide for Swift or Objective-C and Android step by step guide.
Please also see additional documentation on URL Handling for Android and iOS.
Using APIs #
In your app import the package and utilize the SFMCSdk APIs.
// Import the SFMC package into your application
import 'package:sfmc/sfmc.dart';
// Utilize the APIs
SFMCSdk.getSystemToken();
Please find the API Refrences below.
API Reference #
Kind: global class
- SFMCSdk
- .isPushEnabled() ⇒
Future<bool?> - .enablePush() ⇒
Future<void> - .disablePush() ⇒
Future<void> - .getSystemToken() ⇒
Future<String?> - .getAttributes() ⇒
Future<Map<Object?, Object?>?> - .setAttribute(key, value) ⇒
Future<void> - .clearAttribute(key) ⇒
Future<void> - .addTag(tag) ⇒
Future<void> - .removeTag(tag) ⇒
Future<void> - .getTags() ⇒
Future<List<String>> - .setContactKey(contactKey) ⇒
Future<void> - .getContactKey() ⇒
Future<String?> - .enableLogging() ⇒
Future<void> - .disableLogging() ⇒
Future<void> - .logSdkState() ⇒
Future<void> - .trackEvent(event) ⇒
Future<void> - .getDeviceId() ⇒
Future<String?> - .setAnalyticsEnabled(analyticsEnabled) ⇒
Future<void> - .isAnalyticsEnabled() ⇒
Future<bool> - .setPiAnalyticsEnabled(analyticsEnabled) ⇒
Future<void> - .isPiAnalyticsEnabled() ⇒
Future<bool>
- .isPushEnabled() ⇒
SFMCSdk.isPushEnabled() ⇒ Future<bool?> #
The current state of the pushEnabled flag in the native Marketing Cloud SDK.
Kind: static method of SFMCSdk
Returns: Future<bool?> - A future to the nullable boolean representation of whether push is
enabled.
See
SFMCSdk.enablePush() ⇒ Future<void> #
Enables push messaging in the native Marketing Cloud SDK.
Kind: static method of SFMCSdk
See
SFMCSdk.disablePush() ⇒ Future<void> #
Disables push messaging in the native Marketing Cloud SDK.
Kind: static method of SFMCSdk
See
SFMCSdk.getSystemToken() ⇒ Future<String?> #
Returns the token used by the Marketing Cloud to send push messages to the device.
Kind: static method of SFMCSdk
Returns: Future<String?> - A future to the nullable system token string.
See
SFMCSdk.getAttributes() ⇒ Future<Map<String, String>> #
Returns the maps of attributes set in the registration.
Kind: static method of SFMCSdk
Returns: Future<Map<String, String>> - A future to the string key/value map of attributes set
in the registration.
See
SFMCSdk.setAttribute(key, value) ⇒ Future<void> #
Sets the value of an attribute in the registration.
Kind: static method of SFMCSdk
See
| 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. |
SFMCSdk.clearAttribute(key) ⇒ Future<void> #
Clears the value of an attribute in the registration.
Kind: static method of SFMCSdk
See
| Param | Type | Description |
|---|---|---|
| key | string |
The name of the attribute whose value should be cleared from the registration. |
SFMCSdk.addTag(tag) ⇒ Future<void> #
Adds a tag to the list of tags in the registration.
Kind: static method of SFMCSdk
See
| Param | Type | Description |
|---|---|---|
| tag | string |
The tag to be added to the registration. |
SFMCSdk.removeTag(tag) ⇒ Future<void> #
Removes a tag from the list of tags in the registration.
Kind: static method of SFMCSdk
See
| Param | Type | Description |
|---|---|---|
| tag | string |
The tag to be removed from the registration. |
SFMCSdk.getTags() ⇒ Future<List<String>> #
Returns the list of tags currently set in the registration.
Kind: static method of SFMCSdk
Returns: Future<List<String>> - A future to the list of strings representing the tags
currently set in the registration.
See
SFMCSdk.setContactKey(contactKey) ⇒ Future<void> #
Sets the contact key for the device's user.
Kind: static method of SFMCSdk
See
| Param | Type | Description |
|---|---|---|
| contactKey | string |
The contact key to be set for the device's user. |
SFMCSdk.getContactKey() ⇒ Future<String?> #
Returns the contact key associated with the device's user.
Kind: static method of SFMCSdk
Returns: Future<String?> - A future to the nullable string representation of the contact key
associated with the device's user.
See
SFMCSdk.enableLogging() ⇒ Future<void> #
Enables verbose logging within the native Marketing Cloud SDK and Unified SFMC SDK.
Kind: static method of SFMCSdk
See
SFMCSdk.disableLogging() ⇒ Future<void> #
Disables verbose logging within the native Marketing Cloud SDK.
Kind: static method of SFMCSdk
See
SFMCSdk.logSdkState() ⇒ Future<void> #
Instructs the native SDK to log the SDK state to the native logging system (Logcat for Android and Xcode/Console.app for iOS). This content can help diagnose most issues within the SDK and will be requested by the Marketing Cloud support team.
Kind: static method of SFMCSdk
See
SFMCSdk.trackEvent(event) ⇒ Future<void> #
This method helps to track events, which could result in actions such as an InApp Message being displayed.
Kind: static method of SFMCSdk
See
| Param | Type | Description |
|---|---|---|
| event | CustomEvent | EngagementEvent | SystemEvent | CartEvent | OrderEvent | CatalogObjectEvent |
The event to be tracked. |
SFMCSdk.getDeviceId() ⇒ Future<String?> #
Returns the deviceId used by the Marketing Cloud to send push messages to the device.
Kind: static method of SFMCSdk
Returns: Future<String?> - A future to the device Id.
See
SFMCSdk.setAnalyticsEnabled(analyticsEnabled) ⇒ Future<void> #
Enables or disables analytics in the Marketing Cloud SDK.
Kind: static method of SFMCSdk
See
| Param | Type | Description |
|---|---|---|
| analyticsEnabled | boolean |
A flag indicating whether analytics should be enabled. |
SFMCSdk.isAnalyticsEnabled() ⇒ Future<bool> #
Checks if analytics is enabled in the Marketing Cloud SDK.
Kind: static method of SFMCSdk
Returns: Future<bool> - A future to the boolean representation of whether analytics is enabled.
See
SFMCSdk.setPiAnalyticsEnabled(analyticsEnabled) ⇒ Future<void> #
Enables or disables Predictive Intelligence analytics in the Marketing Cloud SDK.
Kind: static method of SFMCSdk
See
| Param | Type | Description |
|---|---|---|
| analyticsEnabled | boolean |
A flag indicating whether PI analytics should be enabled. |
SFMCSdk.isPiAnalyticsEnabled() ⇒ Future<bool> #
Checks if Predictive Intelligence analytics is enabled in the Marketing Cloud SDK.
Kind: static method of SFMCSdk
Returns: Future<bool> - A future to the boolean representation of whether PI analytics is enabled.
See
3rd Party Product Language Disclaimers #
Where possible, we changed noninclusive terms to align with our company value of Equality. We retained noninclusive terms to document a third-party system, but we encourage the developer community to embrace more inclusive language. We can update the term when it’s no longer required for technical accuracy.