停止后台 javascript activity 在位置触发的蓝牙中心 iOS 唤醒
Stopping background javascript activity on location-triggered bluetooth-central iOS wakes
我正在使用 Cordova Gimbal plugin to monitor bluetooth beacons in the background. iOS wakes up the app while in the background to send it bluetooth beacon sighting events; the Gimbal SDK 处理这些并调用插件中的 objc 处理函数。我删除了在 window 对象上触发事件的任何代码,以试图在 10 秒执行 window.[=17 时阻止 运行 中的任何 javascript =]
但是,javascript 无论如何都会在这些后台事件上执行:我的应用程序使用 Angular,并且昂贵的 $digest
循环在后台继续。 $interval
(setInterval()
的包装器)也可以。似乎虽然应用程序在 10 秒 window 中处于 运行,但它只是保持在 运行 javascript 引擎上,就好像它在前台一样。这会显着影响应用程序的电池使用情况。如何让 cordova 事件循环在处理完信标瞄准后停止执行?
版本:cordova 6.5.0 cordova-ios 4.3.1
我发现如果我们切换到使用 WKWebView,javascript 引擎不会 运行 机会主义地像这样。因此,添加 this plugin(并修复开关的影响)解决了这个问题。
我正在使用 Cordova Gimbal plugin to monitor bluetooth beacons in the background. iOS wakes up the app while in the background to send it bluetooth beacon sighting events; the Gimbal SDK 处理这些并调用插件中的 objc 处理函数。我删除了在 window 对象上触发事件的任何代码,以试图在 10 秒执行 window.[=17 时阻止 运行 中的任何 javascript =]
但是,javascript 无论如何都会在这些后台事件上执行:我的应用程序使用 Angular,并且昂贵的 $digest
循环在后台继续。 $interval
(setInterval()
的包装器)也可以。似乎虽然应用程序在 10 秒 window 中处于 运行,但它只是保持在 运行 javascript 引擎上,就好像它在前台一样。这会显着影响应用程序的电池使用情况。如何让 cordova 事件循环在处理完信标瞄准后停止执行?
版本:cordova 6.5.0 cordova-ios 4.3.1
我发现如果我们切换到使用 WKWebView,javascript 引擎不会 运行 机会主义地像这样。因此,添加 this plugin(并修复开关的影响)解决了这个问题。