Requests in background mode
zaouifahd opened this issue · comments
Hi, great job
For my app, i use location in background with update interval , but when the app is in background the requests is not sent to server , I think the requests is put on queue. And when the app back to the foreground the requests is send to the server.
Please anyone have idea, i need use location in background.
Thank you in advance for replay
Does it work without the wkwebview plugin?
Yes background location work without the wkwebview plugin.
May be the same problem.
I tried background fetch for iOS.
https://github.com/transistorsoft/cordova-plugin-background-fetch
onDeviceReady: function() {
this.receivedEvent('deviceready');
var Fetcher = window.BackgroundFetch;
var fetchCallback = function () {
$.ajax({
url: 'https://api.github.com/users/litehelpers/repos',
dataType: 'json',
crossDomain: true,
success: function (res) {
console.log("finish");
Fetcher.finish();
},
error: function (e) {
console.log("background-fetch error: " + err);
Fetcher.finish();
}
});
};
var failureCallback = function() {
console.log("background failed");
};
Fetcher.configure(fetchCallback, failureCallback, {
stopOnTerminate: false
});
},
This code works fine. However, Success will not be called when adding this plugin.
Process seems to be waiting. Success is called when the application to foreground.