avioli / uni_links

Flutter plugin for accepting incoming links.
BSD 2-Clause "Simplified" License
563 stars 303 forks source link

getInitialLink returns the same link when app brought to foreground from background #83

Open maheshj01 opened 3 years ago

maheshj01 commented 3 years ago

Get initialLink() returns the same link when the app is brought from background to foreground without clicking the link

To Reproduce Steps to reproduce the behavior:

  1. I launched the app by clicking a deep link and triggered getIntialLink()
  2. I moved the app to the background by pressing the home button
  3. And then brought it back to foreground the getInitialLink() got triggered it should have returned null but it returns the same link the app was launched with;

Expected behavior I think the expected behavior is it should have returned null when brought to foreground from background; let me know If I am wrong or you have a different opinion

avioli commented 3 years ago

I've updated the README to highlight that both getInitialLink and getInitialUri should be handled only once during app's life. You can call it as many times as you wish to get the link that started the app (or store the value in a global place), but you should only handle it once.

For future link invocations of the app you should use the linkStream or uriLinkStream. They will produce a link when the OS wants to either foreground your backgrounded app or if your app is already in the foreground - to receive data from another app (mostly on a tablet when two apps are on-screen, side by side).

kateile commented 2 years ago

@avioli the problem is getInitialLink returns the same link even after app's life ends. So the same link previously handled keep appear over and over again without even being invoked. I think you should see this gif here

agil3st commented 2 years ago

This issue still exist on v0.4.0. how to solve it?