Schedule background task

Hi,
I’d like to call a service function daily to keep data up to date, is there a way to launch such task in background ?
I thought to use localNotification to do so, is it the right way ?

Regards

Hi,

Any ideas ?

Thanks

http://forum.ionicframework.com/t/did-you-ever-found-a-solution-for-some-regular-background-activity/25843

Hi,

thanks but the topic is private, i can’t access it.

on android: same as many other problems: only active while plugged in (or when the app is in the foreground)… without a partial wakelock!

So I made my own solution, https://github.com/boltex/cordova-plugin-powermanagement

I modified the power management plugin : I changed SCREEN_DIM_WAKE_LOCK to PARTIAL_WAKE_LOCK

here’s how i use it along with the background mode plugin so the app is never in bakcground and always running as a service…:

if( ionic.Platform.isAndroid() ){
cordova.plugins.backgroundMode.enable();

window.powerManagement.dim(function() {
console.log(‘Wakelock acquired’);
}, function() {
console.log(‘Failed to acquire wakelock’);
});
window.powerManagement.setReleaseOnPause(false, function() {
console.log(‘setReleaseOnPause successfully’);
}, function() {
console.log(‘Failed to set’);
});

}

2 Likes

Hi. How did you get to access this link? Thanks

How can I access this link? Thanks

it’s what i posted on july 15. copy pasted as-is. again , just look at https://github.com/boltex/cordova-plugin-powermanagement

Thanks a lot, @boltex, it seem really a solution.