Skip to content

bug: [Android] Push notification tap ignored when WebSocket is reconnecting on app foreground #7013

@deepak0x

Description

@deepak0x

Describe the Bug

On Android, when a user taps a push notification while the app is backgrounded and the WebSocket has disconnected, the app opens but does not navigate to the relevant room. The notification tap is silently ignored.

The notification data is correctly stored in SharedPreferences by the native Android layer (PushNotificationModule), but the only JS code that reads it — checkPendingNotification() in app/sagas/state.js — is gated behind meteor.connected. Since the WebSocket is still reconnecting at the moment the app foregrounds, the early return at if (!isReady) { return; } is hit and checkPendingNotification() is never called.

There is no fallback — checkPendingNotification() is called in exactly one place in the entire codebase. The notification data remains in SharedPreferences until the next time the user backgrounds and re-foregrounds the app with an active WebSocket connection. If a second notification tap occurs in the meantime, the first notification is permanently overwritten and lost.

This is Android-only. iOS uses Expo's addNotificationResponseReceivedListener which has no WebSocket dependency.

Steps to Reproduce

  1. Log in to the app on a physical Android device
  2. Background the app and wait 3–5 minutes for the WebSocket to disconnect (or enable battery optimization / restrict background activity for the app in device settings)
  3. From another account, send a message to trigger a push notification
  4. Tap the push notification from the notification shade
  5. The app opens but remains on the last visited screen — no navigation to the room

Expected Behavior

Tapping a push notification should always navigate the user to the relevant room, regardless of the current WebSocket connection state at the moment of foregrounding.

Actual Behavior

The app opens but does not navigate to the room. The notification tap is silently dropped because checkPendingNotification() in app/sagas/state.js is never reached due to the isAuthAndConnected() guard returning false while the WebSocket is reconnecting.

Rocket.Chat Server Version

NA

Rocket.Chat App Version

NA

Device Name

NA

OS Version

NA

Additional Context

No response

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