Description
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:
- Implement Linking react-native-windows#687 (comment)
- The two links in this comment are not valid.
- https://docs.microsoft.com/en-us/windows/uwp/launch-resume/handle-uri-activation#step-1-specify-the-extension-point-in-the-package-manifest
- I do not see any specific settings to enable the app to listen to new URI activation while it is already running.
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?