$ cordova plugin add cordova-plugin-background-service
The plugin creates the object window.BackgroundService
with the methods start(success, failure, config)
, and stop(success, failure)
.
window.BackgroundService.start(
function(fn) { dosometing(), fn && fn() },
function() { console.log('err') }
)
https://github.com/katzer/cordova-plugin-background-mode
https://github.com/transistorsoft/cordova-plugin-background-fetch