1

My Blazor maui application calls an Api and gets a redirect url to a payment page.

Once the payment is complete, the payment page will redirect to testapp://payment-success .

The issue is that I am unsure how to re-open the same instance of the application and then show a success/fail to the user.

The closet solution I have is to add the following snippet to the Package.appxmanifest file inside Application

  <uap:Extension Category="windows.protocol">
    <uap:Protocol Name="testapp" />
  </uap:Extension>

and then add the following override in App.xamal.cs

protected override void OnLaunched(LaunchActivatedEventArgs args)
    {
        var eventargs = Microsoft.Windows.AppLifecycle.AppInstance.GetCurrent().GetActivatedEventArgs();
        if (eventargs.Kind is ExtendedActivationKind.Protocol && eventargs.Data is Windows.ApplicationModel.Activation.ProtocolActivatedEventArgs activationArgs)
        {

            var uri = activationArgs.Uri;
            var authority = uri.Authority;
            var localPath= uri.LocalPath;

        }
        base.OnLaunched(args);
    }

When the payment page redirects to testapp://component1/success-page it does reach OnLaunched and the parameters are extractable, however there is no way to redirect to the relevant razor page and for some reason a new instance of the application is created

03v
  • 11
  • 2

0 Answers0