2.5 KiB
2.5 KiB
15. App Shortcuts & Widgets
meta: id: android-production-15 feature: android-production priority: P2 depends_on: [] tags: [native-features, widgets, production]
objective:
- Implement app shortcuts and home screen widgets to improve user engagement and accessibility
deliverables:
- Dynamic and static app shortcuts
- Home screen widget (threat score)
- Widget configuration
- Shortcut deep linking
steps:
- Implement app shortcuts:
- Static shortcuts in shortcuts.xml:
- "View Dashboard" → opens dashboard
- "Check Alerts" → opens alerts
- "Run Scan" → starts DarkWatch scan
- Dynamic shortcuts:
- "Recent Alert" → opens latest alert
- "Quick Check" → runs quick threat assessment
- Static shortcuts in shortcuts.xml:
- Create home screen widget:
- GlanceAppWidget for modern Compose widgets
- Or traditional AppWidgetProvider
- Sizes: 2x1 (threat score), 3x2 (score + alerts)
- Update every 30 minutes (widget limit)
- Design widget UI:
- Match app design system
- Show threat score with color coding
- Show number of unread alerts
- Show last update time
- Support dark/light themes
- Implement widget updates:
- Update on app data refresh
- Schedule periodic updates
- Handle widget configuration changes
- Add deep linking:
- Tap widget → open dashboard
- Tap alert count → open alerts list
- Tap threat score → open dashboard
- Add preview:
- Widget preview image for picker
- Description for accessibility
- Test:
- Add widget to home screen
- Verify updates work
- Test shortcuts
tests:
- Unit: Test widget provider
- Integration: Test shortcut deep links
- UI: Test widget rendering
acceptance_criteria:
- 3+ app shortcuts defined
- Static shortcuts working
- Dynamic shortcuts updated based on user activity
- Home screen widget showing threat score
- Widget updates every 30 minutes
- Widget supports dark and light themes
- Deep links from shortcuts and widgets work
- Widget preview in picker
- No crashes when widget data missing
- Widgets work on Android 8+ (API 26+)
validation:
- Long press app icon → shortcuts visible
- Tap shortcut → correct screen opens
- Add widget to home screen → threat score displayed
- Receive new alert → widget updates
- Tap widget → dashboard opens
- Check widget in dark mode → colors correct
notes:
- App shortcuts are great for power users
- Widgets use RemoteViews (limited UI capabilities)
- Glance is modern but requires additional dependency
- Test on different launchers (Pixel, Samsung, Nova)