Skip to content

[question]: Background / Terminated State Notification Storage in OneSignal Flutter SDK v5 #1085

@gappscstech

Description

@gappscstech

How can we help?

I am using OneSignal Flutter SDK v5 in my app.

Problem:
When the app is in background or terminated state, I am unable to store notifications locally (e.g., in Hive or SQLite).
In foreground, everything works fine — the Dart callbacks are triggered, and I can store notifications.
In background/terminated, OneSignal shows the notification in the system tray, but my Dart code never runs, so I cannot save the notification data.

What I tried:
Creating a Flutter background handler → does not trigger in terminated state
Using deprecated native notification extension classes → removed in SDK v5

Questions:
Does OneSignal SDK v5 provide any way to intercept notifications in background or terminated state on Android?
If not, what is the recommended approach for storing notifications locally in background/terminated state?
Is it expected that OneSignal Flutter SDK cannot save notifications in Dart while the app is killed, and we must rely on native Android code or FCM?

FCM handles this by allowing “data messages” to trigger a Dart background handler even when the app is terminated.
Is there any similar option in OneSignal to process notifications in background/terminated state in Flutter?

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions