Track your campaigns: With the default FCM module, the SDK auto-tracks delivered and body opened. Action-button clicks are never automatic — use a receiver + track(...). For the dual-path custom FCM service used in the Android example, see Push Notification Tracking.
Prerequisites
Before implementing push notifications:- Configure FCM in Zixflow dashboard - Add your FCM Server Key in the Zixflow dashboard first
- Firebase Project Setup - Create Firebase project and add your Android app
- Install the push messaging module - Add
messaging-push-fcmdependency
Step 1: Firebase Project Setup
1. Create Firebase Project
- Go to https://console.firebase.google.com
- Click Add project or select existing project
- Follow the setup wizard
2. Add Android App to Firebase
- In Firebase console, click Add app → Select Android
- Enter your app’s package name (e.g.,
com.yourcompany.app) - (Optional) Add SHA-1 certificate for debugging
- Download
google-services.json
3. Add google-services.json to Project
- Place
google-services.jsonin yourapp/directory - Verify the file is at:
app/google-services.json
Step 2: Add Dependencies
1. Add Google Services Plugin
Project-levelbuild.gradle.kts:
build.gradle (Groovy):
2. Apply Plugin in App Module
App-levelbuild.gradle or build.gradle.kts:
3. Add Zixflow and Firebase Dependencies
Kotlin DSL:Step 3: Initialize Zixflow with Push Support
Basic Initialization (Kotlin)
Basic Initialization (Java)
- Registers a
FirebaseMessagingServicein your manifest - Fetches and registers FCM device tokens
- Handles push notification display and tracking
Step 4: Register Application in AndroidManifest.xml
Ensure your customApplication class is registered:
Step 5: Request Push Notification Permission (Android 13+)
Android 13 (API 33) and higher requires runtime permission for notifications.Request Permission in Activity
Step 6: Identify Users
Critical: Device tokens must be associated with a user before push notifications can be delivered.- When users start the app, they automatically generate a device token
- This token links to their Zixflow profile when you call
identify() - This ensures notifications are delivered to the correct user
Configuration Options
Configure push notification behavior withMessagingPushModuleConfig:
Configuration Options
Push Click Behaviors
Three strategies control app navigation when notifications are tapped:ACTIVITY_PREVENT_RESTART (Default - Recommended)
- Reuses existing activities when possible
- Ideal for apps with sensitive screens (checkout, payment)
- Prevents interrupting user workflows
ACTIVITY_NO_FLAGS
- Creates new activity instance on every notification tap
- Standard Android behavior
RESET_TASK_STACK
- Clears entire app state
- Prevents back navigation to previous screens
- Use when you want fresh app start
Advanced Features
Customize Notification Appearance
Override notification appearance usingZixflowPushNotificationCallback:
Attach action buttons
The SDK builds title, body, and image but does not auto-attach action buttons. Parseaction_buttons from payload.extras inside onNotificationComposed and call builder.addAction with PendingIntents that your app handles (for example a BroadcastReceiver).
BroadcastReceiver (for example NotificationActionReceiver) with matching intent action. In the receiver: track Opened, then Push Notification Action Clicked, then NotificationManagerCompat.cancel(notificationId) (action presses do not auto-dismiss). See Push Notification Tracking and NotificationActionReceiver.kt.
Configure Default Icon and Color
Add metadata toAndroidManifest.xml:
Rich Push Notifications
Rich push (images, videos, GIFs) is automatically supported by the SDK. No additional configuration needed. Send rich media from Zixflow dashboard:- Create push notification campaign
- Add image URL or video URL
- SDK automatically downloads and displays media
Custom FirebaseMessagingService (dual-path)
Android routes FCM to oneFirebaseMessagingService. If you declare your own, remove the SDK service from the merged manifest, then try the SDK helper first and fall back to manual display + metrics when it returns false.
Reference: CustomFirebaseMessagingService.kt.
Zixflow- and ZIXFLOW- delivery key casings. For body opens on the manual path, put delivery ID/token on the content PendingIntent extras and call trackMetric(Opened) in your Activity — see the example MainActivity.handlePushOpenIntent.
Tracking Push Metrics
Full details: Push Notification Tracking.
Deep Links and Custom Actions
For Zixflow campaign taps, the Android example does not rely onhttps intent filters alone. It:
- Puts
deeplink_urlon the contentPendingIntent(body) and per-buttondeeplinkon action intents - Tracks Opened / Action Clicked (see Push Notification Tracking)
- Opens the URL via
DeeplinkRouter— custom scheme hosts → Activities; otherwiseACTION_VIEW
Testing Push Notifications
1. Verify Device Token Registration
Check if device token is registered:2. Enable Debug Logging
Use debug logging to troubleshoot:3. Test on Physical Device or Emulator
Physical Device: Always works with validgoogle-services.json
Emulator: Requires:
- Google Play Services installed
- Signed in with Google account
- Internet connectivity
4. Send Test Push from Zixflow
- Log into Zixflow dashboard
- Navigate to Messaging → Push Notifications
- Create test push notification
- Send to specific user (using
userIdfromidentify())
Troubleshooting
google-services.json Not Found
Error:File google-services.json is missing
Solution:
- Verify
google-services.jsonis inapp/directory - Sync Gradle: File → Sync Project with Gradle Files
- Clean and rebuild: Build → Clean Project → Rebuild Project
Push Notifications Not Received
Symptoms: Notifications sent but not delivered Solutions:- Verify FCM Server Key configured in Zixflow dashboard
- Ensure user is identified:
Zixflow.instance().identify(userId = ...) - Check POST_NOTIFICATIONS permission granted (Android 13+)
- Verify device token registered:
Zixflow.instance().registeredDeviceToken - Test on physical device or emulator with Google Play Services
- Check Firebase console for delivery status
Device Token Not Registering
Symptoms:registeredDeviceToken returns null
Solutions:
- Verify
google-services.jsonis correct and inapp/directory - Ensure
google-servicesplugin is applied - Check Google Play Services available on device
- Verify app package name matches Firebase configuration
- Check logs for FCM token generation errors
Notification Not Displayed
Symptoms: Push delivered but not shown Solutions:- Check notification channels (Android 8.0+)
- Verify notification permission granted
- Ensure app not in “Do Not Disturb” mode
- Check notification settings for your app
- Verify custom notification callback isn’t blocking display
Rich Media Not Loading
Symptoms: Images/videos not appearing in notifications Solutions:- Verify media URL is accessible from device
- Check internet connectivity
- Ensure media format is supported (JPEG, PNG, GIF for images)
- Check file size (large files may timeout)
Best Practices
- Always identify users before sending push notifications
- Request permission thoughtfully - explain value before requesting
- Use ACTIVITY_PREVENT_RESTART for better user experience
- Test on multiple devices and Android versions
- Enable debug logging during development
- Monitor metrics in Zixflow dashboard
- Handle permission denial gracefully
- Test deep links thoroughly
- Customize notification appearance to match app branding
- Keep google-services.json secure - don’t commit to version control