OneSignal-Flutter-SDK
OneSignal-Flutter-SDK copied to clipboard
[question]: Setup Notification to open The app from terminal state
trafficstars
How can we help?
I Searched the docs bit Found Nothing , i want to setup my service such that upon clicking on notification it opens the app, so Far working on fore/back ground states but when the app is in terminated state Clicking the notification does nothing and i need to click it one or 2 more times
My Setup
initOneSignal() {
OneSignal.Debug.setLogLevel(
OSLogLevel.error,
);
OneSignal.initialize (AppConstants.oneSignalAppID);
OneSignal.Notifications.requestPermission(true);
}
setupNotification(BuildContext context) {
OneSignal.Notifications.addClickListener((openedResult) {
PodcastEntity podcastEntity = PodcastModel.fromJson(
jsonDecode(
openedResult.notification.additionalData!["podcast"],
),
).toEntity;
context.read<NotificationBloc>().add(
NotificationClickedEvent(
entity: podcastEntity,
),
);
});
}
Code of Conduct
- [x] I agree to follow this project's Code of Conduct