最小化时的Android浏览器javascript事件 [英] Android browser javascript events when minimised

查看:60
本文介绍了最小化时的Android浏览器javascript事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为使用操作系统互联网浏览器运行的Android智能手机构建一个webapp。主界面是输入数据。数据被添加到队列中(android 1.5:gears,android 2.x:html5)。每5分钟(使用setTimeout),脚本会查看互联网连接是否处于活动状态,如果是,则将所有队列发送到服务器。

I'm building a webapp for Android smartphones that runs with the OS internet browser. the main interface is to input datas. the data is added to a queue (android 1.5: gears, android 2.x: html5). Each 5 minutes (using setTimeout), the script looks if an internet connection is active, and if so, sends all the queue to the server.

如果手机已插入在墙上和网页上,超时工作。如果浏览器已最小化或其他应用程序在其上运行,则超时不起作用。如果手机处于睡眠模式,它也不起作用。

If the phone is plugged on the wall and the webpage is ontop, the timeout works. if the browser is minimized or another application runs on top of it, the timeout doesn't work. if the phone is in sleep mode it doesn't work either.

只能在后台运行原生应用吗?

can only native apps runs in background?

推荐答案


只能在
背景下运行本机应用程序?

can only native apps runs in background?

当然,对于您的睡眠模式,我不希望浏览器唤醒设备。显然,根据您的症状,当浏览器本身暂停时,它们会暂停所有Javascript线程。考虑到使这些脚本运行的电池问题可能导致这种情况,这并不是非常令人震惊。

Certainly, I would not expect the browser to be waking up the device, for your sleep mode scenario. Apparently, based on your symptoms, they pause all Javascript threads when the browser itself is paused. That is not terribly shocking, given the battery problems that leaving those scripts running might cause.

这篇关于最小化时的Android浏览器javascript事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆