Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent Android from closing a Progressive Web App playing audio in the background

I've written a progressive web app which plays music using the Web Audio API. A common user journey is to start the music playing, then change to other apps whilst still listening to the music. This works fine for a while, until android decides that it needs more resources for the other apps and closes down my PWA without warning.

Is there a way to hint to the browser and OS that despite not being in the foreground, the user is still using a particular web app? I'm fine for it to be tidied up in the background when the music is paused, but not whilst the user is still listening to something.

The main browser I'm interested in is Chrome for Android (though something platform agnostic would be ideal).

like image 558
lucas Avatar asked Aug 11 '16 22:08

lucas


People also ask

Can progressive web app run in background?

Using a service worker, a Progressive Web App (PWA) can do work in the background, even when the user isn't using the app. Service workers used to be reserved for native apps, but they are now also available to PWAs, providing a better offline experience.

How do I know if apps are running in the background Android?

To open Quick Settings, from the top of the screen, swipe down twice. To see the number of active apps running in the background: At the bottom left, tap # active apps. Or, at the bottom right, tap the number next to Settings and Power .


1 Answers

I have created a bug for this Chrome bug

If you have steps to reproduce, please comment on the bug

like image 121
NaijaBoy Avatar answered Sep 24 '22 06:09

NaijaBoy