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 plugins
https://github.com/christocracy/cordova-plugin-background-geolocation
https://github.com/MrNickBreen/backgroundLocation
But they seen quite difficult to be integrated with Rollbase
It would be helpful if anyone could provide suggestion of background location tracking solution.
Thank you.
Hi all,
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.
However, if you do need a Javascript execution at certain interval and worry about the app going to sleep after the app been idle for some time, cordova-plugin-background-mode is more energy efficient alternative to Insomnia-PhoneGap-Plugin,
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.
For now, the Javascript execution has been successful on every 5 minutes or more, and I can use the JSDO service generated with the OpenEdge mobile during background mode.
I do however interested to look at improve the plugin with AlarmManager from Android.
Thank you.
Hello,
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?
My understanding is that JavaScript execution is suspended when an application goes to the background or the device goes to sleep.
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.
Hello,
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
the application will go into pause mode and javascript execution will be suspended
I tested on Sony Xperia Z3 Compact , Android 4.4.4
Hello,
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?
My understanding is that JavaScript execution is suspended when an application goes to the background or the device goes to sleep.
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.
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.
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.
My initial test shown that the background mode is activated when I go to Home page, or lock screen at Android, but the app still go sleep after a while, it seen the background mode will create another intent activity, I will need test if running the javascript process in the new activity thread will help in long running background task.
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.
Flag this post as spam/abuse.
Hi all,
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.
However, if you do need a Javascript execution at certain interval and worry about the app going to sleep after the app been idle for some time, cordova-plugin-background-mode is more energy efficient alternative to Insomnia-PhoneGap-Plugin,
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.
For now, the Javascript execution has been successful on every 5 minutes or more, and I can use the JSDO service generated with the OpenEdge mobile during background mode.
I do however interested to look at improve the plugin with AlarmManager from Android.
Thank you.
Plugin author of cordova-plugin-background-geolocation. I've refactored Android. The plugin now executes your Javascript callback -- no longer handles HTTP within plugin.
Plugin author of cordova-background-geolocation plugin here. I've never heard of Rollbase. Contact me if you need help with integration.
Wrt.
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)