开发者

Does any browser in iOS and Android allow events to trigger when the application (browser) is inactive/in background? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 3 years ago.

Improve this question

What I'm wondering is basically what (if any) browsers in iOS and Android allow events to trigger when the browser is inactive/in background/sleeping?

If any: What kind of events will t开发者_开发知识库his browser in that OS allow?


As far as I know, they do not. If you put the browser in the background, it unloads the page to free some memory for other apps.


In Android, you can accomplish this by writing an Activity whose sole UI component is a web view. Your activity receives many lifecycle events automatically (such as focus / loss of focus) and can request to receive more (such as screen-off, screen-on). You can easily pass these events into the underlying webkit's javascript interface.


If you've got a <video> or <audio> element with a playing media file in iOS Safari, the ended event will trigger, even if the browser is not open. This allows you to select a next media file and play it, sorta emulating the native iPod experience.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜