Reputation: 522
I was testing the PWA I created using Angular 8 on Samsung Internet but during the testing I found that my custom PWA banner was not being dismissed even after the installation was completed. This is the code I used to handle the PWA install.
window.addEventListener('beforeinstallprompt', (e) => {
e.preventDefault();
// save it to a variable to be called later
this.deferredAlert = e;
// custom code for PWA banner
});
// When needed I call the prompt() function and listen for user choice
this.deferredAlert.prompt();
this.deferredAlert.userChoice
.then((choiceResult) => {
// cleanup for custom banner
console.log(choiceResult);
})
.catch(console.error);
This method works fine in chrome. When debugging I found that the userChoice promise was not returning any data. Is there a method to get this working on Samsung internet?
Right now the only solution I can think of is to use userAgent to check for Samsung Internet browser and then cleanup the custom banner when the install button is clicked. But this implementation does not work if the user clicks cancel instead of install.
Upvotes: 2
Views: 611