我无法使用Cordova Background fetch插件获取执行ajax请求,
后台获取插件: https://github.com/christocracy/cordova-plugin-background-fetch
角天青移动服务: https://github.com/TerryMooreII/angular-azure-mobile-service
我的代码:
ionic.Platform.ready(function () {
//iOS Background Fetch
if (ionic.Platform.isIOS()) {
var Fetcher = window.BackgroundFetch;
// Your background-fetch handler.
var fetchCallback = function () {
Azureservice.invokeApi('myAPI', {
method: 'post',
body: {
createdby: $scope.userid
}
})
.then(function (count) {
cordova.plugins.notification.badge.set(count);
Fetcher.finish();
}, function (err) {
});
}
var failureCallback = function () {
console.log('- BackgroundFetch failed');
};
Fetcher.configure(fetchCallback, failureCallback, {
stopOnTerminate: false // <-- false is default
});
}
});
我该怎么办才能让它发挥作用?