microsoft / reactxp

Library for cross-platform app development.
https://microsoft.github.io/reactxp/
Other
8.29k stars 494 forks source link

How to setup Windows app so that RX.Linking.deepLinkRequestEvent will fire upon a new URI activation, while the app is already running? #1076

Open gabeljz opened 5 years ago

gabeljz commented 5 years ago

I have followed the docs on RX.Linking.deepLinkRequestEvent and example on Microsoft/SubscribableEvent, to arrive at this code:

const event = RX.Linking.deepLinkRequestEvent;
event.subscribe((newUri: string) => {
  console.log('new deeplink', newUri);
  /* more code to handle the newUri */
});

The handler function subscribed to the event can be executed with event.fire(...).

After setting up the Android and iOS apps according to React Native's docs on Linking, the handler function can be executed successfully upon activating a new URI while the respective app is already running.

I can't find any exact information on setting up Windows app to listen to incoming app links during the app's execution. The closest informations that I found are:

Using the TodoList app as an example, my current setting in the Package.appxmanifest is:

// TodoList/windows/TodoList/Package.appxmanifest
<Extensions>
  <uap:Extension Category="windows.protocol">
    <uap:Protocol Name="todo" />
  </uap:Extension>
</Extensions>

With this setting, the app can handle URI "todo://todos?selected=new", but only at initial launch and that the app must not be already running. Even then, the URI is retrieved from RX.Linking.getInitialUrl(), the handler function subscribed to RX.Linking.deepLinkRequestEvent is simply never executed.

So how can I setup Windows app to listen to incoming app links while the app is already running?

erictraut commented 5 years ago

@gabeljz, were you able to get this working? If so, let us know how you solved it.

fbartho commented 4 years ago

Is this still a concern @gabeljz? -- I'm not using the Windows platform but I'd be happy to review documentation PRs if you want to make one?