Planning Challenge in Cordoba

I am developing a mobile application (platform: Android, iOS) with Cordova.

My application needs a ping URL to retrieve data every hour. I want my application to still ping the url when it is closed.

I searched on google and I get some of these plugins:

I need a plugin like the second, but also work when the application is closed, like a scheduled notification, such as the first.

Is there such a plugin for cordova? Or it is not possible to complete a background task like this with a cord.

thanks

+6
source share
1 answer

I had one and the same problem, I had to select lat, lng every few minutes and calculate the distance, but only one plug-in could not solve it, because it stops working when the phone falls asleep .. so I had to make sure that the phone did not fall asleep ..

So, I used the power management plugin along with the background plugin .. and it works well.

Background Mode Plugin: https://github.com/katzer/cordova-plugin-background-mode

Power Management Plugin https://github.com/boltex/cordova-plugin-powermanagement

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'); }); } 
+3
source

All Articles