Unable to reload the app programatically on Javascript UWP app.

Dorin 21 Reputation points
2022-10-02T10:23:07.93+00:00

The application is configured to be run as Hosted Web App.

So the app itself is served from an URL, and each time there are internet issues, the msapp-error.html is triggered, and in order to continue using the app, we are forced to restart it, so that it will connect to the URL again and extract the resources to run it on Xbox.

QUESTION: Is there any API or configuration that we can set up so that we can trigger the app restart by clicking a button (added by us)? Or even better to automatically reload if the internet connection is back?

Universal Windows Platform (UWP)
{count} votes

Accepted answer
  1. Roy Li - MSFT 32,731 Reputation points Microsoft Vendor
    2022-10-03T02:20:58.41+00:00

    Hello,

    Welcome to Microsoft Q&A!

    Is there any API or configuration that we can set up so that we can trigger the app restart by clicking a button (added by us)?

    Yes, there is an API that you could use. With the Fall Creators Update (1709), a new method on WebUIApplication called RequestRestart() is add. This API could programatically restart the app. Please note that you need the 16299 SDK (or later) to access this API.

     Windows.UI.WebUI.WebUIApplication.requestRestartAsync("Restart")  
    

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful