2.9 KiB
2.9 KiB
24. FCM Push Notification Deep Linking
meta: id: android-production-24 feature: android-production priority: P2 depends_on: [android-production-21] tags: [native-features, push-notifications, production]
objective:
- Ensure FCM push notifications correctly deep link to relevant screens with proper handling of app state
deliverables:
- Deep link routing for all notification types
- Cold start handling
- Background notification processing
- Notification analytics
steps:
- Audit existing FCM handling:
- Review android/app/.../service/FCMService.kt
- Review NavGraph.kt for deep links
- Identify gaps in notification handling
- Implement deep link routes:
- Alert notification → AlertDetail screen
- Exposure notification → DarkWatch screen
- Scan complete → Dashboard screen
- Family invite → Settings/Family
- Subscription renewal → Settings/Billing
- Marketing → Landing or specific feature
- Handle app states:
- App closed (cold start): launch → process notification → navigate
- App background: wake → process → navigate
- App foreground: show in-app snackbar → navigate on tap
- Add notification actions:
- Alert: "View Details", "Dismiss", "Mark Safe"
- Exposure: "View Exposure", "Start Removal"
- Scan Complete: "View Results", "Share"
- Implement analytics:
- Track notification delivery
- Track notification open rates
- Track conversion from notification to action
- A/B test notification copy
- Add notification preferences:
- Allow user to customize notification types
- Respect system notification settings
- Update backend preferences
- Test all scenarios:
- Cold start from each notification type
- Background tap on notification
- Foreground notification handling
- Action button taps
tests:
- Unit: Test deep link route mapping
- Integration: Test FCM message handling
- Device: Send test notifications via Firebase Console
acceptance_criteria:
- All notification types deep link to correct screens
- Cold start from notification opens correct screen
- Background notification tap navigates correctly
- Foreground notifications show in-app snackbar
- Actionable notification buttons work
- Notification preferences respected
- Analytics tracking delivery and open rates
- Rich notifications with images render correctly
- No crashes from malformed notification payloads
- Unit tests for all deep link routes
validation:
- Send test alert notification → tap → AlertDetail opens
- Send exposure notification → app closed → DarkWatch opens
- Receive notification in foreground → snackbar shown
- Tap action button → correct action performed
- Check analytics → open rate tracked
notes:
- FCMService.kt already exists but may need enhancement
- Use NavDeepLinkBuilder for proper deep linking
- Test on different OEM skins (Samsung, Xiaomi)
- Coordinate with backend on notification payload format