Question

I have a WP app that use NotificationHub.

To register the user, I call RegisterNativeAsync.

However, some users having slow connection raise to me that the loading is very long.

Is it possible to pass a CancellationToken when calling RegisterNativeAsync ?

Thanks,

Was it helpful?

Solution

The method RegisterNativeAsync doesn't directly support a cancellation token itself but if you want to add a timeout you could do this by having another task which creates a timeout and using Task.WhenAny to simulate this.

As this is an awaitable method there should be no need for this to be causing any kind of delay for the user.
Perhaps you need to look at the UX around this call.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top