Skip to content

Fix Android deep link push notifications causing app restart in foreground#368

Merged
imSzukala merged 4 commits intomainfrom
irena/notifications-fix
Feb 25, 2026
Merged

Fix Android deep link push notifications causing app restart in foreground#368
imSzukala merged 4 commits intomainfrom
irena/notifications-fix

Conversation

@imSzukala
Copy link
Contributor

@imSzukala imSzukala commented Feb 19, 2026

When the app is in the foreground and receives an Intercom push notification with a deep link, the app was unexpectedly restarting (showing splash screen) before navigating to the deep link destination.

Root cause:

  • TaskStackBuilder is designed to create a synthetic back stack and calls startActivities() internally - Android treats it as creating a new task stack
  • With singleTask launch mode, Android's behaviour is to destroy the existing instance and create a new one when startActivities() is called

Solution:

  • Added isAppInForeground() helper method to detect app state
  • Only add launch intent to TaskStackBuilder when app is in background/killed
  • When app is in foreground, use empty TaskStackBuilder for direct navigation

before:

Screen_recording_20260216_160250.webm

after:

Screen_recording_20260216_160852.webm

@imSzukala imSzukala enabled auto-merge (squash) February 25, 2026 12:24
@imSzukala imSzukala merged commit 524a2fd into main Feb 25, 2026
8 checks passed
@imSzukala imSzukala deleted the irena/notifications-fix branch February 25, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants