Skip to content

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

Closed
imSzukala wants to merge 1 commit intomainfrom
irena/deep-links-fix
Closed

Fix Android deep link push notifications causing app restart in foreground#367
imSzukala wants to merge 1 commit intomainfrom
irena/deep-links-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 marked this pull request as ready for review February 19, 2026 14:46
@imSzukala imSzukala closed this Feb 19, 2026
@imSzukala imSzukala deleted the irena/deep-links-fix branch February 19, 2026 15:08
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.

1 participant

Comments