开发者

Can mobile web apps run in the background? (iOS & Android)

开发者 https://www.devze.com 2023-04-04 09:59 出处:网络
Can mobile we开发者_运维知识库b apps run in the background? I\'m mostly interest in iOS & Android.

Can mobile we开发者_运维知识库b apps run in the background? I'm mostly interest in iOS & Android.

Thanks!


Since this is a situation that changes almost daily, I'll post an updated answer. This applies to the recent releases of these browsers but may change tomorrow!

My music app is HTML5 and needs to run in the background. The support for that varies depending on mobile browser.

  • Safari on iOS: will continue to play one or two songs in the background
  • Native browser on Android: will play one song then stops
  • Firefox on Android: will stop when screen locks or browser loses focus or song ends
  • Dolphin on Android: plays in background but eventually stops
  • Opera on Android: Excellent background support! Javascript continues to run and music continues to play even when screen is off or Opera is sent to the background. Opera even puts a play/pause toggle into the notification page. Yay.

Here is a related SO question.


Nope, they can't. On Android you could conceivably install a different browser, but it's not possible on the stock one. @jgillman points out the exception of audio in iOS but that's the only exception I'm aware of.


iOS allows audio from a web app (Mobile Safari) to be played in the background. I don't know about other events though.


You can't run web app in the background. To enable most of the native features, you should develop native application.


At the time of this answer, Firefox mobile and Opera mobile for Android do allow javascript to run in the background, even with the screen locked.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号