Skip to content

pushNotificationReceived sometimes not triggered on Android when sending via FCM API #2332

Open
@mleister97

Description

@mleister97

Bug Report

Plugin(s)

@capacitor/push-notifications 7.0.0

Capacitor Version

Latest Dependencies:

  @capacitor/cli: 7.1.0
  @capacitor/core: 7.1.0
  @capacitor/android: 7.1.0
  @capacitor/ios: 7.1.0

Installed Dependencies:

  @capacitor/android: 7.1.0
  @capacitor/cli: 7.0.1
  @capacitor/ios: 7.1.0
  @capacitor/core: 7.1.0

Platform(s)

  • iOS
  • Web
  • Android

Current Behavior

Expected Behavior

The method pushNotificationReceived is only called sometimes on Android.

Code Reproduction

PushNotifications.addListener('registration', (token) => {
  // working fine
})

PushNotifications.addListener(
  'pushNotificationReceived',
  (notification: PushNotificationSchema) => {
    // only working on Android when sending via debugging firebase cloud console
  }
)

// Method called when tapping on a notification
PushNotifications.addListener(
  'pushNotificationActionPerformed',
  (notification: ActionPerformed) => {
    // working fine
  }
)

Other Technical Details

All methods work perfectly on both Android and iOS. On Android, I can easily respond to the listeners for pushNotificationActionPerformed and registration. However, pushNotificationReceived is only called on iOS, while on Android, it is only triggered occasionally.

Perhaps this information helps with debugging:
When I send notifications to FCM via their API, they only work on iOS. However, when I send test messages directly through Firebase debugging, they work on both platforms.

Additional Context

Samsung Galaxy S24
Android Version 14

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions