Skip to content

[question]: Setup Notification to open The app from terminal stateΒ #1006

@tazy-dev

Description

@tazy-dev

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions