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 (notificationTokenis 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.onBackgroundMessagehandler registered
- There is no use of flutter_local_notificationsto manually show native Android notifications fordata-onlymessages
- I believe Traccar sends data-onlypayloads, 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 onBackgroundMessagewith native notification handling out-of-the-box?
- Has anyone implemented flutter_local_notificationsto 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.onMessageProblem: On Android, I don’t see any notification in the system tray when the app is in the background or terminated.
Tests and observations:
notificationTokenis present in user attributes)Technical analysis
From what I see in the current Flutter codebase:
FirebaseMessaging.onBackgroundMessagehandler registeredflutter_local_notificationsto manually show native Android notifications fordata-onlymessagesdata-onlypayloads, so on Android, unless manually handled, they won’t appear in the system notification trayQuestions
onBackgroundMessagewith native notification handling out-of-the-box?flutter_local_notificationsto 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
onBackgroundMessagewith local notifications if needed.—
Sébastien