title: Call Javascript function in background task in iOS
body: <p>I have a phonegap app and I want to execute Javascript code in a background task. When the application enters background I start executing a javascript function which takes data out of a web database and sends some values to a web service, the returning data may toggle a push-notification to the user.</p>
  
  <p>I found either how to call javascript from Objective-C <a href="https://stackoverflow.com/questions/2463710/calling-javascript-from-objective-c-code">here on Stackoverflow</a> and how to implement Long-Running Background Tasks in the <a href="https://web.archive.org/web/20140824215114/https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html" rel="nofollow noreferrer">iOS SDK Documentation pages</a>, but I haven't found anything in combining both (what I think is e.g.: When I invoke javascript code via a webview, does this View even exist when the App is in background?) so I want to ask some more experienced iOS Developers if this is even possible.</p>