[Bug]: When the app is closed, notifications that were received while it was open do not open the app
What happened?
My problem only happens when I receive a notification with the app running (in the foreground or background). When you kill the app and click on the notification, nothing happens. The notification just disappears.
I noticed that the same problem happens with the OneSignal example project here on github. Is this a known limitation?
In all other situations, notifications work perfectly, in the foreground, background and dead.
Steps to reproduce?
class NotificationService {
NotificationService._();
static final NotificationService instance = NotificationService._();
bool initialized = false;
bool appInBackground = false;
bool appOpenByNotification = false;
Future<void> initialize() async {
OneSignal.Debug.setLogLevel(OSLogLevel.verbose);
OneSignal.initialize("MY_APP_ID");
OneSignal.LiveActivities.setupDefault();
OneSignal.Notifications.clearAll();
OneSignal.Notifications.addClickListener((event) {
if (appInBackground) {
appOpenByNotification = true;
AdsService.loadAndShowNotificationAd(callback: () {
handleNotificationReceived(event);
appOpenByNotification = false;
});
} else if (initialized) {
AdsService.loadAndShowNotificationAd(callback: () {
handleNotificationReceived(event);
});
} else {
appOpenByNotification = true;
Timer.periodic(const Duration(milliseconds: 500), (timer) {
if (initialized) {
timer.cancel();
handleNotificationReceived(event);
}
});
}
});
OneSignal.Notifications.addForegroundWillDisplayListener((event) {
event.preventDefault();
event.notification.display();
});
}
}
What did you expect to happen?
I expected the closed app to start when clicking on the notification that was received when the app was running
OneSignal Flutter SDK version
5.2.8
Which platform(s) are affected?
- [ ] iOS
- [X] Android
Relevant log output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Comigo acontece a mesma coisa... Fico no aguardo de alguma atualização!
The same thing is happening to me as well. I noticed this issue about two days ago. I have a Flutter app integrated with OneSignal for long time, and I have never observed this behavior before.
However, in my case, the notification doesn't disappear. Instead, it moves to the end of the notification list. When I click it a second time, it works.
However, in my case, the notification doesn't disappear. Instead, it moves to the end of the notification list. When I click it a second time, it works.
It's true, I noticed that on some devices this also happens too
Facing same issue on Tecno Camon 30s and Redmi 12C.
same here..... do you have any workaround?
facing the same issue
Hi everyone, thank you for reporting this. We believe this is a situation that affects some Samsung and Redmi devices, the fix will be in the next release.
This has been fixed in Release 5.3.2. Please test it out and reach out with any further issues or questions.