You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Zeph Davies (JIRA)" <ji...@apache.org> on 2016/05/18 12:21:12 UTC

[jira] [Commented] (CB-11291) Update capped to 1Hz when in background

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

Zeph Davies commented on CB-11291:
----------------------------------

This may help you:
http://jsfiddle.net/r5szsao2/4/

> Update capped to 1Hz when in background
> ---------------------------------------
>
>                 Key: CB-11291
>                 URL: https://issues.apache.org/jira/browse/CB-11291
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, Plugin Device Motion
>            Reporter: Zeph Davies
>
> Due to the way Android's WebBrowser handles setInterval, when the "tab" is in the background (ie when used in conjunction with backgroundMode plugin), setInterval (used to send the latest value to the application) is capped to 1Hz (once per second).
> This makes the plugin update at a completely different interval to that set by the application.
> One solution is to use a WebWorker to hold the setInterval timer, as it is not limited by the browser.
> The tricky bit is loading the script into the WebWorker, as it requires the "Content-Security-Policy" to allow local files or blobs.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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