You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Shazron Abdullah (JIRA)" <ji...@apache.org> on 2017/06/03 01:32:04 UTC

[jira] [Commented] (CB-12846) WebView JS execution continues when app executes in background

    [ https://issues.apache.org/jira/browse/CB-12846?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16035745#comment-16035745 ] 

Shazron Abdullah commented on CB-12846:
---------------------------------------

The core itself does not continue executing endlessly (there is no event polling) - it is triggered to pull in commands by JavaScript sending a gap:// url. There is one timer here that gets cleared: https://github.com/apache/cordova-ios/blob/master/CordovaLib/cordova.js#L1016-L1031


I couldn't possibly repro this exactly - You could try profiling your app in Safari Web Inspector to see what's going on.


> WebView JS execution continues when app executes in background
> --------------------------------------------------------------
>
>                 Key: CB-12846
>                 URL: https://issues.apache.org/jira/browse/CB-12846
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-ios
>    Affects Versions: cordova-ios@4.3.1
>            Reporter: Grant Patterson
>
> I'm using a [Cordova plugin|https://github.com/happydenn/cordova-plugin-gimbal2] that integrates [a third-party SDK|https://docs.gimbal.com/iosdocs/v2/devguide.html] to listen for bluetooth beacon sighting events. As expected, my app is allowed to run for 10 seconds in the background with the [bluetooth-central UIBackgroundMode|https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html]. Once the necessary processing is completed, the JS event loop runs until the 10-second window closes. Because beacon sightings happen as frequently as several per second, the app runs in the background constantly, killing the user's battery. I can setInterval() in JS with a 1000ms interval and it runs successfully every time; my Angular app runs $digest cycles in the background which are unnecessary and quite expensive.
> I think I need a way for the native plugin code to relinquish execution and return the app to the background.
> StackOverflow: [https://stackoverflow.com/questions/44145031/stopping-background-javascript-activity-on-location-triggered-bluetooth-central]



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org