I've made some PWA and now I'm using 'beforeinstallprompt' to display the prompt letting the user select install or not. When the user select "install" it's of course possible to display a message indicating installation is in progress. But how can we detect the end of installation process? Notice appinstalled is not the way to do that as, despite of its name, this event is not fired at the end of the installation process but... at the begining!
I've tried a "tricks", pooling getInstalledRelatedApps() in order to get the list of installed App thinking that my PWA will be in this list after being installed. Like this:
function checkForRelatedApps()
{
navigator.getInstalledRelatedApps().then(relatedApps => {
console.log("Dans checkForRelatedApps");
if (relatedApps.length != 0)
{
for (let app of relatedApps)
{
console.log(app.platform);
console.log(app.url);
console.log(app.id);
}
}
setTimeout(checkForRelatedApps,4000);
});
}
But strange: even if the PWA is on main screen runnng correctly, it's never visible in the relatedApps array which number of element stay at 0. I've seen some examples about using getInstalledRelatedApps() but all are about "real App" and not about "installed PWA"... So is there a way to detect the end of installation (Android display a Toast about that) and is there a way to detect installation of PWA using getInstalledRelatedApps? (examples welcomed!)
Thanks to you all