flutter_local_notifications for display and action buttons.
Track your campaigns: With this Dart integration you calltrackMetric(opened)and track action clicks yourself. For delivery, opens, and action-button details, see Push Notification Tracking. The reference implementation islib/push_handlers.dartin sdk-examples/flutter.
Prerequisites
- Configure FCM in the Zixflow dashboard — add your Firebase / FCM credentials
- Firebase project — create a project and add both iOS and Android apps
- Identify users — call
identify()before sending notifications so tokens attach to a profile - Test on physical devices — iOS Simulator cannot receive remote pushes
Platform-Specific Requirements
iOS
- iOS 13.0+, Xcode 14.0+
- Push Notifications capability enabled
- Optional Notification Service Extension for rich push and reliable delivered metrics
- Physical device for testing
Android
- API 21+ (Android 5.0)
google-services.jsoninandroid/app/POST_NOTIFICATIONSfor Android 13+ (API 33+)coreLibraryDesugaring(required byflutter_local_notifications)
Step 1: Firebase Project Setup
- Create or open a project at Firebase Console
- Add an iOS app (bundle ID), download
GoogleService-Info.plist→ios/Runner/ - Add an Android app whose package name matches
applicationIdinandroid/app/build.gradle, downloadgoogle-services.json→android/app/
applicationId must match the package name registered in Firebase, or FCM token registration fails.
Step 2: Add Dependencies
Step 3: Initialize Firebase and Zixflow
Nativegoogle-services.json / GoogleService-Info.plist is enough. FlutterFire (firebase_options.dart) is optional.
Step 4: Handle Push Notifications (Dart path)
Use FCM for receive/token andflutter_local_notifications to display notifications (including action buttons). Track opens with trackMetric and action presses with track('Push Notification Action Clicked', ...).
Token registration
Permission
Message listeners and tracking
push_notification_clicked. Use trackMetric(..., MetricEvent.opened) and the reserved action event name below.
Step 5: Identify Users
identify().
Local Notifications (Display + Action Buttons)
Channel IDzixflow_default, Android icon app_icon, iOS category ZX_2BTN, actions ACTION_0 / ACTION_1. Pass the full message.data map as JSON payload so taps can track and deep-link.
payload: jsonEncode(data) with the full FCM data map (include title/body for action tracking). Support up to two AndroidNotificationActions (ACTION_0 / ACTION_1), download image_url / large_icon_url for rich media, map sticky == 'true' to Android ongoing: true (with autoCancel: true), and set iOS categoryIdentifier: 'ZX_2BTN'.
Background FCM handler
The background handler must also display the local notification (so action buttons work when the app is backgrounded or terminated):Push Payload Fields
Zixflow data payload fields used by the Dart handlers:
Example:
iOS-Specific Setup
Push capabilities
- Open
ios/Runner.xcworkspace - Runner target → Signing & Capabilities
- Add Push Notifications
- Add Background Modes → enable Remote notifications
AppDelegate — register ZX_2BTN
Notification Service Extension (rich push + delivered)
- File → New → Target → Notification Service Extension (e.g.
NotificationServiceExtension) - Enable App Groups on Runner and the extension (same group ID, e.g.
group.com.yourcompany.app) - Podfile — NSE only (Runner does not need
zixflow/fcmfor this Dart path):
NotificationService.swift:
cdpApiKey (not apiKey) and set .appGroupId(...) to the same App Group as the host app.
Android-Specific Setup
Gradle (plugins DSL)
android/settings.gradle:
android/app/build.gradle:
Permissions and deeplink package visibility
app_icon (referenced by AndroidInitializationSettings('app_icon')).
Deeplink opening (example pattern)
After tracking Opened / Action Clicked, open URLs the same way aspush_handlers.dart + navigation.dart:
navigatorKey to MaterialApp. Full open / action / delivered contract: Push Notification Tracking.
Testing
- Register token +
identify()a test user - Enable
LogLevel.debug - Send a test push from the Zixflow dashboard (include
action_buttonsif testing buttons) - Use a physical iOS device; Android emulator needs Google Play Services
Troubleshooting
Best Practices
- Initialize Firebase before Zixflow, then your push handlers
- Identify users after login;
clearIdentify()on logout - Store the full FCM data map in the local-notification payload for tracking
- Prefer button
deeplinkoverdeeplink_urlon action taps - Cancel the notification ID on action press (Android)
- Re-initialize Zixflow in the background notification-response isolate
- See Push Notification Tracking for metrics details