I've built an app using meteor and cordova plugins. I want the app to run in background. What is currently happening is, app stops working after being in background for about 10 minutes. Is it possible to run meteor mobile app running in background?
Asked
Active
Viewed 997 times
4
-
As a side-note, please have pity for the poor phone and its decreasing battery level. – Kyll May 29 '15 at 10:41
-
I understood the concern. Perhaps can I run it in background without monitoring geo location? – prgmrDev May 29 '15 at 12:43
1 Answers
2
I've tested it recently, the cordova app may run in the background for hours (at least one whole day, not tested for a longer time) and the geolocation was working during this whole day. This was tested on Android L, don't know for iOS.
Not sure if it always stays connected to the server but at least the client side is still running.
Also, to preserve the battery I only check for geolocation every x minutes, using Meteor.setInterval
and mdg:geolocation package:
Meteor.setInterval(function () {
Session.set('geoLocation', newGeolocation);
}, 60000 * 15); //15 minutes

255kb - Mockoon
- 6,657
- 2
- 22
- 29
-
when I tested the app, it ran for around 10 minutes on Android. Is there any way to keep it running in background? I've came across this http://stackoverflow.com/questions/10343828/creating-an-android-service-with-phonegap-have-phonegap-app-run-even-when-clos, is there any package available in meteor for the same? – prgmrDev Jun 02 '15 at 11:16
-
I did not add anything special, I saw that on Android there is a `keepRunning` option to run in the background, but default is already set to true (https://cordova.apache.org/docs/en/3.0.0/guide_platforms_android_config.md.html) – 255kb - Mockoon Jun 02 '15 at 14:21