auto_route_library
auto_route_library copied to clipboard
DeepLink Not Triggered When App is in Foreground
auto_route version : 7.8.3 Describe the bug:
When attempting to use deep linking with auto_route
, the specified URL from the deep link builder does not open when the app is in the foreground. However, the link works as expected when the app is in the closed state.
To Reproduce:
- Bring the app to the foreground (app should not be in the closed state).
- Execute the following ADB command to test deep linking:
adb shell 'am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d https://example.in/otherprofile/adwaith#4497"' in.adwaith.now
- Observe that the app does not respond to the deep link.
Expected behavior:
- The app should open the specified URL regardless of whether it's in the foreground or the closed state.
- If I am in the
OtherProfileScreen
for user 'abcd' and I click on a URL for another user, it should refresh theOtherProfileScreen
with the correct username.
Code Snippet:
Here is my deepLinkBuilder
function:
dart
FutureOr<DeepLink> deepLinkBuilder(PlatformDeepLink? deepLink) {
if (deepLink?.path == '/') {
return DeepLink.defaultPath;
} else if (deepLink?.path.startsWith('/otherprofile') ?? false) {
String? path =
deepLink?.path.split('/otherprofile/')[1].replaceFirst('-', '#');
return DeepLink([
MainScreen(children: [
HomeRoute(children: [OtherProfileScreen(username: path ?? '')])
])
]);
}
return DeepLink.defaultPath;
}
Additional context:
Currently, I am using a separate screen for debugging. I would appreciate any suggestions or best practices for debugging deep linking with auto_route
.
Flutter 3.13.2 • channel stable Framework • revision ff5b5b5fa6 (12 days ago) • 2023-08-24 08:12:28 -0500 Engine • revision b20183e040 Tools • Dart 3.1.0 • DevTools 2.25.0
I have this problem - deepLinkBuilder not triggered at all by deeplink!
@Pavel-dnipro Did you find any solution?
same here
I have this problem - deepLinkBuilder not triggered at all by deeplink!
I as well had the Issue of only the app opening but not navigating and not even triggering the deeplinkBuilder. Only on iOS though. All was working fine if set up in a new Project referring to the cookbook. So my last resort was removing the whole ios project and add it new and fresh to the Project. That worked! Just had to setup all my tweaks and settings again 🙄... The Problem seemed to stem from the project.pbxproj file.
@Milad-Akarie any progress for this issue ?
same here.
when app is terminated, deepLinkHandler callback works, but foreground or background(not task killed), deepLinkHandler ONLY works root path /
only.
Having the same issue in Android, everything works when the app is killed. If I put the back just in background, the deep link builder is not triggered, it doesn't navigate to the route. Any updates on this?