I'm developing a simple app with phonegap which every 30 seconds send user current coordinates to my database via ajax call.It works very well
$(document).ready(function() {
setInterval(function() {
SetLocationUpdates();
}, 30000);
});
If the app is in the foreground there is no problem and everything works fine, but if I open google maps app with this code
<div><a href="geo:41.897096,27.036545">Open maps app</div>
My app goes in the background(my app and google map app work separately.Two apps work at same time) and the interval function is not executed any more.
Is it possible to have the javascript code (a timer function) executing in the background with phonegap?
Edited:
I use cordova-plugin-background-mode(https://github.com/katzer/cordova-plugin-background-mode) but it still does not work.And alert give false.What is wrong with this?
document.addEventListener('deviceready', function () {
cordova.plugins.backgroundMode.enable();
alert(cordova.plugins.backgroundMode.isActive());
}, false);