javascript - setInterval functions not running when app in background -


i'm developing simple app phonegap every 30 seconds send user current coordinates database via ajax call.it works

$(document).ready(function() {     setinterval(function() {             setlocationupdates();         }, 30000);          }); 

if app in foreground there no problem , works fine, if open google maps app code

<div><a href="geo:41.897096,27.036545">open maps app</div> 

my app goes in background(my app , google map app work separately.two apps work @ same time) , interval function not executed more.

is possible have javascript code (a timer function) executing in background phonegap?

edited:

i use cordova-plugin-background-mode(https://github.com/katzer/cordova-plugin-background-mode) still not work.and alert give false.what wrong this?

document.addeventlistener('deviceready', function () {      cordova.plugins.backgroundmode.enable();     alert(cordova.plugins.backgroundmode.isactive()); }, false); 


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -