Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-11291

Update capped to 1Hz when in background

VotersWatch issueWatchersLinkUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      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.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            Zeph Davies Zeph Davies
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment