Hi,
I'm working on a custom version of the Traccar Manager Flutter app from the official repo: https://github.com/traccar/traccar-manager.
Everything works as expected:
- Firebase Cloud Messaging is correctly integrated (valid
google-services.json
)
- Notifications are received while the app is in the foreground using
FirebaseMessaging.onMessage
- On iOS, push notifications work perfectly (foreground, background, and lock screen)
Problem: On Android, I don’t see any notification in the system tray when the app is in the background or terminated.
Tests and observations:
- Notifications are enabled at the Android OS level
- The FCM token is correctly received and stored in the server (
notificationToken
is present in user attributes)
- The Traccar server sends push messages (confirmed working in foreground)
- On Android emulator, the notification does appear in the tray, but on real devices, it doesn’t show up unless the app is open
Technical analysis
From what I see in the current Flutter codebase:
- There is no
FirebaseMessaging.onBackgroundMessage
handler registered
- There is no use of
flutter_local_notifications
to manually show native Android notifications for data-only
messages
- I believe Traccar sends
data-only
payloads, so on Android, unless manually handled, they won’t appear in the system notification tray
Questions
- Is this behavior expected for all Flutter-based Traccar clients on Android?
- Is there a plan to support
onBackgroundMessage
with native notification handling out-of-the-box?
- Has anyone implemented
flutter_local_notifications
to handle background messages properly on Android? Is there a community branch or example?
- Is this omitted intentionally due to security or architectural reasons?
Thank you in advance for your help !
I'm happy to contribute a proper implementation of onBackgroundMessage
with local notifications if needed.
—
Sébastien
Hi,
I'm working on a custom version of the Traccar Manager Flutter app from the official repo: https://github.com/traccar/traccar-manager.
Everything works as expected:
google-services.json
)FirebaseMessaging.onMessage
Problem: On Android, I don’t see any notification in the system tray when the app is in the background or terminated.
Tests and observations:
notificationToken
is present in user attributes)Technical analysis
From what I see in the current Flutter codebase:
FirebaseMessaging.onBackgroundMessage
handler registeredflutter_local_notifications
to manually show native Android notifications fordata-only
messagesdata-only
payloads, so on Android, unless manually handled, they won’t appear in the system notification trayQuestions
onBackgroundMessage
with native notification handling out-of-the-box?flutter_local_notifications
to handle background messages properly on Android? Is there a community branch or example?Thank you in advance for your help !
I'm happy to contribute a proper implementation of
onBackgroundMessage
with local notifications if needed.—
Sébastien