flutter / flutter/flutter

Deeplink on Android fail silently if app is backgrounded and then killed by OS

Open
#178,305 5 comments 3 reactions 1 assignee Claimed by @camsim99 View on GitHub
engine f: routes found in release: 3.35 found in release: 3.38 has reproducible steps p: material_ui P1 package platform-android team-android triaged-android
Dominant language
Dart
Stars
179k
Forks
31.1k
PR merge metrics
PR metrics pending

Description

### Steps to reproduce

1. Clone https://github.com/rajveermalviya/test_deep_links
2. Run the app on Android
3. Gesture/press Android Home button to background the app
4. Run the following command to [emulate](https://developer.android.com/tools/adb#am) Android OS' low-memory killing of background apps

```shell
$ adb shell am kill com.example.test_deep_links
```

5. Trigger a deeplink using the following command:

```shell
$ adb shell 'am start -a android.intent.action.VIEW \
-c android.intent.category.BROWSABLE \
-d "testdeeplinks:///details"'
```

6. Notice that app launches but remains on the Home page, and doesn't route to the Details page.

### Expected results

When the deeplink is triggered, the Details page in the app should be opened.

This can be exercised by skipping the Step 4 and carrying out those steps again. Or clearing the app from Recent apps view (essentially fully terminating it) and then triggering the deeplink with the above command.

### Actual results

When the deeplink is triggered, the Home page in the app is visible and the app doesn't route to the Details page.

### Code sample
https://github.com/rajveermalviya/test_deep_links

### Screenshots or Video

_No response_

### Logs

Logs

```console
$ flutter logs
Showing sdk gphone64 arm64 logs:
D/FlutterJNI( 7097): Beginning load of flutter...
D/FlutterJNI( 7097): flutter (null) was loaded normally!
I/flutter ( 7097): [IMPORTANT:flutter/shell/platform/android/android_context_gl_impeller.cc(104)] Using the Impeller rendering backend (OpenGLES).
I/flutter ( 7097): The Dart VM service is listening on http://127.0.0.1:43149/xoyY3hKKgWM=/
D/FlutterJNI( 7145): Beginning load of flutter...
D/FlutterJNI( 7145): flutter (null) was loaded normally!
I/flutter ( 7145): [IMPORTANT:flutter/shell/platform/android/android_context_gl_impeller.cc(104)] Using the Impeller rendering backend (OpenGLES).
I/flutter ( 7145): The Dart VM service is listening on http://127.0.0.1:46065/0F2jQRx12bo=/
```

### Flutter Doctor output

Doctor output

```console
$ flutter doctor -v
[!] Flutter (Channel [user-branch], 3.38.0-1.0.pre-429, on macOS 26.1 25B78 darwin-arm64, locale en-US) [225ms]
! Flutter version 3.38.0-1.0.pre-429 on channel [user-branch] at /Users/rajveer/sdk/flutter
Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/setup.
! Upstream repository unknown source is not a standard remote.
Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
• Framework revision 004aabad68 (6 days ago), 2025-11-05 11:09:20 -0800
• Engine revision 3fd81edbf1
• Dart version 3.11.0 (build 3.11.0-93.0.dev)
• DevTools version 2.52.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, omit-legacy-version-file, enable-lldb-debugging
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [964ms]
• Android SDK at /Users/rajveer/Library/Android/sdk
• Emulator version 36.2.12.0 (build_id 14214601) (CL:N/A)
• Platform android-36, build-tools 35.0.0
• ANDROID_HOME = /Users/rajveer/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 21.0.8+-14196175-b1038.72)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 26.1) [578ms]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 17B55
• CocoaPods version 1.16.2

[✓] Chrome - develop for the web [5ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Connected device (3 available) [5.7s]
• Rajesh’s iPhone (wireless) (mobile) • 00008030-000149CA1A04802E • ios • iOS 26.1 23B85
• macOS (desktop) • macos • darwin-arm64 • macOS 26.1 25B78 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 142.0.7444.135

[✓] Network resources [846ms]
• All expected network resources are available.

! Doctor found issues in 1 category.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.