-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Describe the bug
I am using firebase_messaging with a flutter app. This app has not been worked on in a few months, but push notifications were previously working as expected. Sending a notification through a cloud function, or a test notification through the Firebase console would come through 100% of the time, and if the app was in the background the notification would play a sound and appear in the system tray (on virtual and physical devices).
After running the app recently, push notifications do not go into the system tray under any circumstances. In an Android 11 virtual device, the notification history for the device shows the notifications come through, but are listed under "Recently dismissed". They are placed here immediately and there is no sound or notification shown to the user.
I had recently moved from firebase_messaging 5.1.4 to 6.0.16. But moving back to 5.1.4 did not resolve the issue.
If the app is in the foreground, onMessage fires successfully. onBackgroundMessage was also added as per the readme instructions, but it does not fire under any circumstances (app in foreground, background, or closed). And again, under no circumstances do notifications go to the system tray. The notification from the cloud function is the same as before:
notification: { title: title, body: body, }, data: { type: dataType, content: dataContent, click_action: 'FLUTTER_NOTIFICATION_CLICK', }, android: { notification: { channel_id: 'mychannel', }, priority: 'high', }, token: token };
Expected behavior
Test notification sent from Firebase console should enter the device notification system tray and play a sound, remaining until dismissed by the user.
Flutter doctor
Run flutter doctor
and paste the output below:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.20.1, on Microsoft Windows [Version 10.0.19041.388], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[√] Android Studio (version 4.0)
[√] Connected device (2 available)
• No issues found!