Skip to content

Comments

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

Open
imSzukala wants to merge 2 commits intomainfrom
irena/notifications-fix
Open

Fix Android deep link push notifications causing app restart in foreground#368
imSzukala wants to merge 2 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

Comment on lines +6 to +7
xcode: 16.4.0
resource_class: m4pro.medium
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to change this because of this error on CI: "Job was rejected because resource class macos.m1.large.gen1, image xcode:16.0.0 is not a valid resource class"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant