Skip to content

Android remoteNotificationReceived event fired multiple times  #86

@jbenzshawel

Description

@jbenzshawel

When the application is opened from tapping a push notification the 'remoteNotificationReceived' event is fired multiple times for the same notification.

Example:

  1. Open app by pressing push notification in app tray
  2. Remote notification event fires with payload of push notification sent when app closed
  3. Send another notification with app open
  4. Remote notification event fires with payload of notification sent when app open
  5. Put the app in background then foreground
  6. Remote notification event fires again with payload corresponding to push notification sent when the app was closed.
  7. Whenever app is brought active from background the notification event fires again with the payload corresponding to the push notification sent when app was closed. This behavior continues until the app is restarted.

When adding the event listener I am using the following to ensure the event listener has not been added multiple times:

const onReceivedListeners = PushNotificationEmitter.listeners(DEVICE_NOTIF_EVENT);

if (onReceivedListeners.length === 0) {
    PushNotificationEmitter.addListener(DEVICE_NOTIF_EVENT, pushNotificationRecevied);
}

The app is using the "singleTop" android launch mode.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions