Schedule background task


#1

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


#2

Hi,

Any ideas ?

Thanks


#3

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


#4

Hi,

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


#5

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’);
});

}


#6

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


#7

How can I access this link? Thanks


#8

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