Search code examples
javascriptandroid-webviewprogressive-web-apps

PWA `beforeinstallprompt` not being fired on Android Webview


I created a PWA, display an install page if the app is not installed.

Install page contains an install button, beforeinstallprompt event handler enables the install button.

It is working fine and able to install if I open it from the chrome installed on the phone.

I shared the app URL by Facebook Messenger, and the browser opened by Facebook Messenger doesn't fire beforeinstallprompt event. MDN says beforeinstallprompt works on webView.

Is there anything else needed to work on webView? Here is my code

window.addEventListener("beforeinstallprompt", function(e) {
  e.preventDefault();
  document.getElementById('btnInstall').disabled = false;
  deferedEvent = e;
});

Solution

  • According to Progressive Web Apps in 2020 it won't work.

    You can not install PWAs from Facebook Mobile Browser, Firefox Preview, WebViews, Custom Tabs or Chrome for DayDream (VR mode).