sfmc_plugin 1.0.3 sfmc_plugin: ^1.0.3 copied to clipboard
Salesforce Marketing Cloud (SFMC) - MobilePush SDK for Flutter. Implement the MobilePush SDK for your iOS and Android applications in Flutter.
sfmc_plugin #
Salesforce Marketing Cloud (SFMC) - MobilePush SDK for Flutter.
Marketing Cloud MobilePush lets you create and send notifications to encourage use of your app.
This SFMC Flutter Plugin includes:
-
Push Notifications
Create a message using one of the templates in Marketing Cloud MobilePush or the Push Notification template in Content Builder or Journey Builder.
-
In-App Messages
In-app messages allow you to interact with your mobile app users while they use your mobile app, which is when they are most engaged. Trigger a message to show in your mobile app when a user opens the app on their device. While you can send this message to all of a contact’s devices, it only shows on the first device that opens the app. In-app messages can’t be created in MobilePush.
Learn more about SFMC Mobile Push SDK:
Install #
Add sfmc_plugin
to your pubspec.yaml
dependencies:
...
dependencies:
flutter:
sdk: flutter
sfmc_plugin:
...
Setup Android #
Create an app in MobilePush. This process connects the device to the MobilePush app you created previously in MobilePush.
Note: The Android SDK requires Android API 21 or greater and has dependencies on the Android Support v4 and Google Play Services libraries.
Set up Firebase #
Follow the Android Firebase setup documentation.
And your Firebase google-services.json to your android/app folder.
Add google-service plugin to your android/app/build.gradle:
apply plugin: 'com.google.gms.google-services'
Add google-services dependency to android/build.gradle:
dependencies {
classpath 'com.google.gms:google-services:4.3.13'
}
Setup iOS #
Note: Please follow the Provision for Push and use the Flutter plugin.
Use Flutter Plugin #
The first step is initializing the SFMC plugin with credential information. Learn more
var isInitialized = await SfmcPlugin().initialize(
appId: '<YOUR_APP_ID>',
accessToken: '<YOUR_ACCESS_TOKEN>',
mid: '<YOUR_MID>',
sfmcURL:
'<YOUR_SFMC_URL>',
senderId: '<YOUR_FIREBASE_CLOUD_MESSAGING_SENDER_ID>',
locationEnabled: false,
inboxEnabled: false,
analyticsEnabled: true,
delayRegistration: true);
The second step is setting your sfmc contact key which is a unique client id in Salesforce Marketing Cloud.
await SfmcPlugin().setContactKey('<Uniquely Identifying Key>');
Learn more by take a look into the provided Example.
Contributions #
🍺 Pull requests are welcome! Feel free to contribute to this project.