llfbandit / app_links

Android App Links, Deep Links, iOs Universal Links and Custom URL schemes handler for Flutter.
https://pub.dev/packages/app_links
Apache License 2.0
220 stars 81 forks source link

Link isn't received by app on Windows when running via IDE #128

Closed MattSolvesGames closed 4 months ago

MattSolvesGames commented 5 months ago

Describe the bug

The link handler doesn't work when running the app on Windows in debug mode (through the IDE), it works only when the executable is running on its own. I have copied the example code and although entering the custom protocol address into my browser brings my app into focus, it doesn't trigger navigation or show up in the console that a link was received. The app is running at C:\Users\<User>\<Project Name>\build\windows\x64\runner\Debug\<Project Name>.exe in both cases (which is the same as the registry entry) so it's not clear to me why one method works and the other doesn't.

I have seen issues like https://github.com/flutter/flutter/issues/32986 in the Flutter repo which suggest that at one point arguments were unable to be passed through through to the app due to how it was getting compiled so this may very well be something that just isn't supported but I thought I'd raise the issue anyway.

Reproduction:

  1. In Android Studio, create File > New > Flutter Project.
  2. From the example folder, copy main.cpp and main.dart to their respective locations, overwriting the default files from creating the project. Add a print statement to the listener so we can see what is getting received.
  3. Add win32 and ffi dependencies.
  4. Copy url_protocol folder and its files to the project.
  5. Run the app.
  6. Enter sample://foo/#/book/hello-deep-linking in the browser address bar and observe that the app gains focus but nothing is printed to the console and the page does not change.

Does it related to

Does the example project work?

Did you fully read the instructions for the targeted platform before submitting this issue? Yes

Uploaded your files to webserver, HTTPS, direct connection, scheme pattern setup, ...

thanhle7 commented 5 months ago

In my understanding, Windows just allow one custom url handler at a time. Did you try manually setting in Default apps for your debug app (the one you run in IDE mode)?

MattSolvesGames commented 5 months ago

I believe it's an issue with the way arguments are(n't) passed to the process while debugging, not an issue with Windows finding the wrong program (plus, there's only one program). Like I said, it gains focus just fine so I know the right app is trying to open the link.

rnl-veolys commented 5 months ago

Why are you saying that the example project does not work?

Please follow Windows setup and do not hard copy anything.