Push Notifications
ShipFlutter uses Firebase Cloud Messaging (FCM) to handle push notifications across all platforms. The notifications module provides a complete setup for handling notifications in the foreground, background, and when the app is terminated.
Setup
-
Follow the FCM setup guide in the Firebase Console
-
For iOS, upload your APNs certificate:
- Go to Firebase Console > Project Settings > Cloud Messaging
- Upload your Apple Push Notification service certificate
-
For Android, the setup is handled automatically by the Firebase CLI
-
For Web, add your Firebase web configuration to
app/web/firebase-messaging-sw.js
Notification Service
The NotificationsService
handles device registration and message handling:
Local Notifications
When the app is in the foreground, FCM messages are displayed using flutter_local_notifications
:
The notification configuration includes:
- Custom notification channel for Android
- Sound and badge support for iOS
- Deep link handling when tapped
Notifications Settings
The settings_view.dart
contains a notifications tile that handles permission requests and device registration:
- Permission requests
- Device registration
- Opening system settings
- Loading states
Background Handling
Background messages are handled in notifications_background.dart
: