Check if PWA is already installed

Answered
0
0

Hi.

Is it possible, from within the Wisej app, to identify if PWA is already installed?
Also, is it possible to identify if the application instance is running as the PWA installed or in the browser?

Thanks in advance.

Ivan
(Wisej 2.2.51.0 – VS 2019 – C#)

  • You must to post comments
Best Answer
0
0

Hi Ivan,

 

There is an event that fires when the standalone application is successfully installed in Chrome and Edge, you can add this to Default.html to use a WebMethod called AppInstalled():

 window.onappinstalled = function () {
    App.MainPage.AppInstalled();
 };

This event only fires for the first initial install.

 

There is apparently another way to check if the PWA is installed using navigator.getInstalledRelatedApplications(), but it does not look like it’s completed or working yet.

 

You can check if the Wisej application is currently running as a PWA standalone application with the following code:

private async void button3_Click(object sender, EventArgs e)
{
    var isStandalone = await EvalAsync("window.matchMedia('(display-mode: standalone)').matches");

    AlertBox.Show($"Standalone Application: {isStandalone}");
}

 

HTH,

Levie

  • You must to post comments
0
0

Hi Levie.

Thank you for the comprehensive answer!
It worked perfectly. Now I can find out whether it is running as PWA or not, and then hide the option to install the PWA when it is running under this mode.

Cheers.

Ivan

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.