Hi, anyone has tried to develop a background location function for the Rollbase/Open Edge mobile?I did a bit of research and found a solution at this link:http://blog.appery.io/2014/02/building-a-gps-tracking-app-with-appery-io/However when I trying out the solution, the app activity is been killed off on Android and the app restarted after it run for a while.I also found some other pluginshttps://github.com/christocracy/cordova-plugin-background-geolocation
But they seen quite difficult to be integrated with RollbaseIt would be helpful if anyone could provide suggestion of background location tracking solution.Thank you.
I have not tried this myself, however, it looks like the application is being suspended after the 3 minutes.
Is the device going to sleep or to the lock screen?
For an HTML5 based app, you would need a Cordova plugin that interfaces with the OS.
The Cordova plugin cordova-plugin-background-geolocation seems to do this. However, I have not tried it.
At the native level, the operating system may provide an API to keep track of location and send events.
The device would keep track of the location and notify the app of significant location changes or any location change depending on the options for the API.
(For example, tracking location at the device level, allows an iOS app to be energy efficient, the device would use the M7 / M8 motion coprocessor to detect a change in location instead than using the GPS antenna.)
The best approach is probably to use a plugin that uses the OS location APIs.
I wonder if preventing the app from going to sleep via a plugin would also help or perhaps, it could help to demonstrate whether the app is going to sleep and it is what is causing the issue.
I found a plugin for this, Insomnia-PhoneGap-Plugin, however, preventing the device from going to sleep and checking the location would use more battery and may not be a viable approach.
I hope this helps.
After some experiment with sending GPS data in background,
The Cordova plugin cordova-plugin-background-geolocation seems be best solution if you have control over the receiving side on the server for Android.
In Android, it create a long running background service that will run on top of your main app and disable service when you main app resume.
I do however interested to look at improve the plugin with AlarmManager from Android.
We have tried steps from blog.appery.io/.../building-a-gps-tracking-app-with-appery-io and background location works fine and we were able to submit geolocation info to MongoDB.
We have tested on HTC One Android 4.4.3. What devices have you tested on?
I have tried that too, however if the interval more than 3 minutes
I tested on Sony Xperia Z3 Compact , Android 4.4.4
I'm glad you made the observation about the battery, Edsel ... sounds like a great way to burn up the battery in short order. I also can't help but wonder whether I would like an app that kept track of my movement even when the phone was idle.
Consulting in Model-Based Development, Transformation, and Object-Oriented Best Practice http://www.cintegrity.com
Hi egarcia, thanks for your helpful advise as always,
I have evaluated the cordova-plugin-background-geolocation and unfortunately it only use a low level native restful HTTP call to send the data back to the server, and we were mainly using JSDO,
They have a call back in the IOS but not for Android.
As for tracking only when the user move, cordova-plugin-background-geolocation had great optimization for the detecting location changes, which could really help to conserve battery usage.
However, the user group of our app is mainly drivers , who always have the phone connected to a car charger, so battery usage is not a main concern and we also sending the location data infrequently (say 15 minutes once).
I found another plugin that will utilize background mode of IOS and Android for to allow the main app running in the background: github.com/.../cordova-plugin-background-mode
Integrating the plugin with app builder is such a painful task, and the official documentation is far from helpful, please look at best alternative at community.progress.com/.../14190.aspx
one thing very important that missed out from the official documentation is that , we need to add cordova.define() to the plugin JS code as this usually take care by the Cordova CLI since most plugin use Require() method.
I'm glad you made the observation about the battery, Edsel ... sounds like a great way to burn up the battery in short order. I also can't help but wonder whether I would like an app that kept
track of my movement even when the phone was idle.
this post as spam/abuse.
Plugin author of cordova-background-geolocation plugin here. I've never heard of Rollbase. Contact me if you need help with integration.
Does this Rollbase Mobile service allow private/paid plugins? PhoneGap Build does not -- the plugins one use must have been uploaded to PhoneGap's servers and MIT-licensed.
My new premium cordova-background-geolocation plugin is not free.
PhoneGap users are shut-out from the superior Android performance of my new premium version (5-10* improvement in battery efficiency)