Skip to content

[Bug]: Not receiving notification on Android when terminated #1016

Closed
@rlee1990

Description

@rlee1990

What happened?

using version 5.3.0
When the app is terminated, I do not receive any push notifications on Android. On iOS, this all works fine.

Steps to reproduce?

OneSignal.Notifications.addForegroundWillDisplayListener((event) {
      log('event: ${event.jsonRepresentation()}');
      if (event.notification.additionalData?['sender'] != null &&
          event.notification.additionalData?['sender'] == 'stream.video') {
        event.preventDefault();
      } else {
        event.notification.display();
      }
    });

    OneSignal.Notifications.addClickListener(handleNotificationClicked);

What did you expect to happen?

I should receive a notification when the app is terminated like on iOS.

OneSignal Flutter SDK version

5.3.0

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

[✓] Flutter (Channel stable, 3.29.0, on macOS 15.3 24D60 darwin-arm64, locale
    en-US) [478ms]
    • Flutter version 3.29.0 on channel stable at
      /Users/rickeylee/Desktop/dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 35c388afb5 (3 weeks ago), 2025-02-10 12:48:41 -0800
    • Engine revision f73bfc4522
    • Dart version 3.7.0
    • DevTools version 2.42.2

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    [2.0s]
    • Android SDK at /Users/rickeylee/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = /Users/rickeylee/Library/Android/sdk
    • Java binary at:
      /Library/Java/JavaVirtualMachines/openjdk-17.jdk/Contents/Home/bin/java
      This JDK is specified in your Flutter configuration.
      To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment Homebrew (build 17.0.13+0)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2) [951ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [8ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.2) [8ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.4+-12422083-b607.1)

[✓] VS Code (version 1.97.2) [7ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.106.0

[✓] Connected device (6 available) [6.7s]
    • Pixel 7 Pro (mobile)                  • 28181FDH300KGN                       • android-arm64  • Android 15 (API 35)
    • iPhone 16 Pro Max (wireless) (mobile) • 00008140-0016614C0C12801C            • ios            • iOS 18.3.1 22D72
    • iPhone 16 Pro Max (mobile)            • 0BE964AE-F5F3-4B7B-B503-4FCDA6F7DC25 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-2 (simulator)
    • macOS (desktop)                       • macos                                • darwin-arm64   • macOS 15.3 24D60 darwin-arm64
    • Mac Designed for iPad (desktop)       • mac-designed-for-ipad                • darwin         • macOS 15.3 24D60 darwin-arm64
    • Chrome (web)                          • chrome                               • web-javascript • Google Chrome 133.0.6943.142

[✓] Network resources [233ms]
    • All expected network resources are available.

• No issues found!

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