90 lines
3.1 KiB
Markdown
90 lines
3.1 KiB
Markdown
# 14. Notification Channels & Rich Notifications
|
|
|
|
meta:
|
|
id: android-production-14
|
|
feature: android-production
|
|
priority: P2
|
|
depends_on: []
|
|
tags: [native-features, notifications, production]
|
|
|
|
objective:
|
|
- Implement notification channels and rich notifications for Android 8+ with proper categorization and user controls
|
|
|
|
deliverables:
|
|
- Notification channels for all notification types
|
|
- Rich notifications with images and actions
|
|
- Notification permission handling (Android 13+)
|
|
- Deep linking from notifications
|
|
|
|
steps:
|
|
1. Create notification channels:
|
|
- Security Alerts (high importance, sound + vibration)
|
|
- Exposure Warnings (high importance)
|
|
- Scan Complete (default importance)
|
|
- Family Activity (default importance)
|
|
- Marketing/Promotions (low importance, no sound)
|
|
- System (low importance)
|
|
2. Configure channel properties:
|
|
- Importance levels appropriate per type
|
|
- Sound selection for alerts
|
|
- Vibration patterns
|
|
- LED color for alerts
|
|
- Lock screen visibility
|
|
3. Implement rich notifications:
|
|
- Large icon for user avatar or app icon
|
|
- BigPictureStyle for exposure screenshots
|
|
- BigTextStyle for alert descriptions
|
|
- MessagingStyle for family notifications
|
|
- Inline reply for quick actions
|
|
4. Add notification actions:
|
|
- Alert: "View Details", "Dismiss", "Mark Safe"
|
|
- Exposure: "View Exposure", "Start Removal"
|
|
- Scan Complete: "View Results", "Share"
|
|
5. Handle Android 13+ permissions:
|
|
- Request POST_NOTIFICATIONS permission
|
|
- Show rationale before system dialog
|
|
- Handle permission denial gracefully
|
|
- Guide users to Settings if denied
|
|
6. Add FCM integration:
|
|
- Review FCMService.kt
|
|
- Handle different message types
|
|
- Show notifications for data messages
|
|
- Handle notification tap actions
|
|
7. Test all scenarios:
|
|
- Foreground notification handling
|
|
- Background notification handling
|
|
- Killed app notification handling
|
|
- Notification action taps
|
|
|
|
tests:
|
|
- Unit: Test notification builder logic
|
|
- Integration: Test FCM message handling
|
|
- Device: Test on Android 10, 12, 13, 14
|
|
|
|
acceptance_criteria:
|
|
- Notification channels created for all types
|
|
- Channels have appropriate importance and settings
|
|
- Rich notifications with images and actions
|
|
- Notification permission requested on Android 13+
|
|
- Permission rationale shown before system dialog
|
|
- Deep links from notifications to correct screens
|
|
- Notification actions working
|
|
- FCM integration handling all message types
|
|
- Notifications grouped by channel
|
|
- No duplicate notifications
|
|
- Unit tests for notification builders
|
|
|
|
validation:
|
|
- Send test alert notification → displays with actions
|
|
- Send exposure notification → shows image
|
|
- Deny permission → app shows guidance to Settings
|
|
- Tap notification → opens correct screen
|
|
- Tap action button → correct action performed
|
|
- Check settings → notification channels visible
|
|
|
|
notes:
|
|
- Android 13 (API 33) requires runtime permission for notifications
|
|
- Notification channels cannot be changed programmatically after creation
|
|
- FCMService.kt already exists but may need enhancement
|
|
- Test on different OEM skins (Samsung, Xiaomi, Pixel)
|