RodrigoSMarques / flutter_branch_sdk

Flutter Plugin for create deep link using Branch Metrics SDK. This plugin provides a cross-platform (iOS, Android, Web).
https://branch.io
MIT License
100 stars 90 forks source link

Android not receiving deeplink when app is already running #293

Closed barees63 closed 9 months ago

barees63 commented 9 months ago

I'm testing on the emulator (via ADB).

If the app is closed the link opens the app and the listener receives the link data, however if the app is already open, it switches to the app and I see "FlutterBranchSDK: triggered onNewIntent" but the listener never receives the link.

On iOS it is working correctly.

barees63 commented 9 months ago

This might be misunderstanding on my part, if the app is open but not foreground then it works, if it's foreground then it ignores the link but this is not going to happen IRL I guess.

RodrigoSMarques commented 9 months ago

To trigger listen even as an app in the foreground, you must add the parameter "branch_force_new_session" = true in Intent.

This can be useful when your app receives a notification with the url for the deeplink.

In this case, you can call

FlutterBranchSdk.handleDeepLink(my_app_url) 

with your URL and it will perform the deeplink processing

barees63 commented 9 months ago

ah, very helpful, thank you!