Wellbeing Mapper Enhanced Notification System

Overview

The Wellbeing Mapper notification system has been significantly enhanced to improve research reliability and participant engagement. The system now uses a dual-notification approach combining device-level notifications with in-app dialogs, ensuring participants don’t miss survey opportunities even when the app is closed.

Major Enhancements (Latest Update)

Device-Level Notifications

Dual Notification Strategy

Enhanced Testing Tools for Research Teams

Feature Highlights

2-Week Recurring Schedule

Smart Notification System

Robust Background Processing

Enhanced User Control

Implementation Details

Files Created/Modified

Enhanced Files:

  1. lib/services/notification_service.dart
    • Core notification scheduling and management
    • NEW: Device-level notification support via flutter_local_notifications
    • NEW: Platform-specific permission handling (Android/iOS)
    • NEW: Comprehensive testing methods for research teams
    • NEW: Enhanced diagnostics and monitoring
    • Background task handling and user preference storage
  2. lib/ui/notification_settings_view.dart
    • User interface for notification preferences
    • NEW: Device notification testing buttons
    • NEW: Permission status and diagnostics display
    • NEW: Enhanced testing tools for research verification
    • Statistics display and management options
  3. pubspec.yaml
    • NEW: Added flutter_local_notifications: ^18.0.1 dependency
    • Enables cross-platform device notification support
  4. lib/main.dart
    • Integrated notification service initialization
    • Added notification headless task handler
  5. lib/ui/home_view.dart
    • Added pending notification check on app startup
    • Shows survey dialog when notifications are due
  6. lib/ui/side_drawer.dart
    • Added “Survey Notifications” menu item
  7. lib/models/route_generator.dart
    • Added route for notification settings screen
  8. docs/DEVELOPER_GUIDE.md
    • Comprehensive documentation of notification system

How It Works

Background Scheduling

// Runs every hour in background
BackgroundFetch.scheduleTask(TaskConfig(
  taskId: 'com.wellbeingmapper.survey_notification',
  delay: 3600000, // 1 hour
  periodic: true,
  // ... configuration
));

Enhanced Notification Flow

  1. Background Check: Every hour, checks if 14+ days have passed since last notification
  2. Dual Notification Trigger: If due, sends both device notification AND sets pending flag
  3. Device Notification: Immediate system notification appears even if app is closed
  4. App Launch Check: When app opens, checks for pending notifications (backup system)
  5. Show Dialog: Displays survey participation dialog if pending (fallback)
  6. Navigate to Survey: “Participate” button opens existing webview system

User Experience Improvements

Testing Workflow for Research Teams

  1. Open App → Settings → Survey Notifications
  2. Test Device Notifications: Verify system-level notifications work
  3. Check Permissions: Ensure proper notification permissions are granted
  4. Monitor Diagnostics: View detailed system status and troubleshooting info
  5. Verify Functionality: Use test buttons to confirm all notification types work
    • Non-Intrusive: Only shows dialog when app is opened, no push notifications
    • User Control: Full settings screen for managing preferences
    • Statistics: Users can see notification history and next reminder date

Technical Advantages

Minimal Dependencies

Cross-Platform

Battery Efficient

Privacy Focused

User Interface

Survey Dialog

When a notification is due, users see:

┌─────────────────────────────────┐
│     Survey Participation        │
├─────────────────────────────────┤
│ Help improve research by        │
│ participating in our survey!    │
│ Your contributions help         │
│ scientists understand human     │
│ mobility patterns.              │
├─────────────────────────────────┤
│  [Maybe Later]  [Participate]   │
└─────────────────────────────────┘

Settings Screen

Accessible via side menu → “Survey Notifications”:

Testing

Manual Testing

  1. Go to Settings → Survey Notifications
  2. Tap “Trigger Survey Prompt Now” to test dialog
  3. Tap “Reset Notification Schedule” to test fresh user experience
  4. Check statistics to verify tracking

Background Testing

The system runs automatically in the background. To verify:

  1. Check SharedPreferences for notification timestamps
  2. Verify background tasks are scheduled
  3. Test app launch with pending notifications

Future Enhancements

The current implementation provides a solid foundation that can be extended with:

Integration Success

The notification system seamlessly integrates with Space Mapper’s existing infrastructure:

This implementation successfully fulfills the requirement for a recurring notification system that prompts users every 2 weeks to respond to surveys via the app’s webview, while maintaining the app’s architecture principles and user experience standards.