Closed cliftonlabrum closed 1 year ago
Hello @cliftonlabrum
You can add this functionality for Msix by using the app_uri_handler_hosts
configuration,
see app_uri_handler_hosts
under the MSIX configuration (click to expand)
in the README file.
Please update if its working for you. BTW great detailed question 👍
@YehudaKremer Thanks so much for your reply!
I added this to the end of my msix
configuration:
app_uri_handler_hosts: myapp
But it fails during packaging with:
'myapp' violates pattern constraint of '([0-9a-zA-Z]+(-[0-9a-zA-Z]+)*.)+[a-zA-Z]{1,63}'. The attribute 'Name' with value 'myapp' failed to parse.
My regex is rusty, but it seems it's expecting a domain name formatted like myapp.com
. But a custom URI is like a protocol itself, not a domain (i.e. myapp://
).
Any idea what I'm doing wrong?
Is app_uri_handler_hosts
expecting the domain that does the redirecting? So if I'm using the Dropbox API, do I put dropbox.com
as that value so that it's allowed to redirect to my app?
Looking through the MSIX README again, I think I may actually want protocol_activation
instead of app_uri_handler_hosts
. I'll give it a try.
My bad sorry
Adding protocol_activation
worked and my app passed Microsoft's app review. Thank you very much for your help! 😄
:information_source: Info
Version:
3.9.1
:speech_balloon: Description
I can't get my Flutter app's custom URI to work after I package my app with MSIX, and I'm trying to figure out if it's a bug with protocol_handler that creates and registers the URI, or if it's something to do with MSIX.
Here's what I've done:
myapp://test
opens my app.flutter pub run msix:create
and signing the MSIX, then running the app on another computer, the app runs, but hitting the custom URI does not open the app.I have confirmed the issue across two apps:
:scroll: Pubspec.yaml
🖥️ Sample Project
Below is a minimal sample project. You will need to add these two packages:
After building the app on Windows, visit
uritest://test
in a web browser, and it should show this:After clicking Open uri_test it will bring the app to the forefront and you should see this in the debug console:
Here are the contents of
main.dart
:You have to add the following to
/windows/runner/main.cpp
:After you package this with MSIX, you must launch it on another user account or computer. This is because (as far as I can tell) the registry edits are already made on your machine with the debug version of the app running.
Could you please check if this is something to do with MSIX or not? This is blocking me on launching two apps on Windows. 😅 Thank you!