Survey123 uses location services in background - drains battery fast!

5115
18
03-11-2019 04:55 PM
TI
by
Occasional Contributor II

When Survey123 (version 3.3.26) on iOS asks permission to use Location Services, I select the 'while using the app' option.

If I check iOS' location services settings, it shows that Survey123 is configured to use location services while using the app and not 'always' or 'never'.

Nevertheless, any time after launching Survey123, it uses location services continuously, whether Survey123 is running on screen or even when it is in the background (and even if the device is idle - I think) and drains the battery very fast.  This is occurring for a number of our users and is causing serious problems here.

Is this a known problem?  Are there any known fixes or work arounds other than killing Survey123 when not in use (or disabling location services when not in use)?

We do not have this problem on our older iOS devices which can only run version 2.8.2 of Survey123, and we only started having this problem on our newer devices recently.  I think it may be related to the recent update of Survey123.

Even if this was working properly, it should not drain the battery this fast.  Does Survey123 allow deferred location updates?  This dramatically increases battery life in the location-aware apps that I've written.  (see:  allowDeferredLocationUpdatesUntilTraveled:timeout: - CLLocationManager | Apple Developer Documentati...  )

(also see:  locationManager:didUpdateLocations: - CLLocationManagerDelegate | Apple Developer Documentation  - the old way doesn't work with deferred location updates).

18 Replies
WilliamNatividad
New Contributor

I have also just run into this issue, on both android and iphone. If you open survey123, even if you don't open any surveys or have any surveys, location services immediately start running. The only way to stop this is to remove survey123's location permissions each and every time, or to restart the phone. 

0 Kudos
BrettStokes
Esri Contributor

Hi William,
You can stop Survey123 using location services by properly closing the app, you don't need to restart your phone or remove location permissions. In Android this means tapping the overview button (which brings up a list of currently open apps), then tapping X or swiping the apps you want to close away. In iOS double-tap the home button to get the multitasking view, then swipe the apps you want to close off the edge of the screen. iPhone X does this differently, swipe up from the bottom of the screen and pause about halfway up the screen to get the multitasking view.

0 Kudos
BrettStokes
Esri Contributor

By design, Survey123 is configured to utilise your device's location when the app is open (background or foreground) to ensure the location is captured as quickly and accurately as possible. This is the same approach as other ESRI apps like Collector and Navigator. Extensive testing was carried out across a multitude of mobile devices, operating systems, internal location sensors and external Bluetooth GNSS receivers, to monitor battery consumption and performance.


This testing included changing Survey123 settings to use the location as needed, when the survey is open and when the app is open. We found that other factors such as device usage, screen time and brightness had a much greater impact on battery consumption.


Can you please provide us some details of your experiences to help us gather more information? For example: What specific devices and operating system versions are you running? Do your surveys take seconds / minutes / hours to complete? What sort of battery consumption are you seeing over what time period. How does Survey123 battery consumption compare to other mapping apps that always using your location (eg Collector, Google Maps etc.)? Are you running other apps and services while using Survey123? Are you operating in areas with wifi and/or mobile data coverage or in remote offline environments?


Thanks,
Brett

0 Kudos
TI
by
Occasional Contributor II

Hi Brett,

Thanks for looking into this for us.  Detailing your testing plans doesn't really reassure us much in this case where multiple people are experiencing a serious issue.  🙂

We are using a variety of iPhones and iPads here.  After my users informed me of the problem, I have replicated it on an iPhone XR running iOS 12.1.4.  As stated earlier, I'm using Survey123 version 3.3.64.

The problem occurs irrespective of whatever survey may be used.  As William stated, you don't actually need to run any survey at all to experience the problem.  All that is required is to open Survey123, and then close it again (ie, return to the 'Springboard' app launcher view.

You will then see the blue bar at the top of the screen in whatever app you are using, to indicate that location services are being actively used.

As I stated earlier, the Settings app shows that Survey123 is configured to use location services only when app is in use.  However, it is somehow bypassing this setting.

What sort of battery consumption are you seeing over what time period. How does Survey123 battery consumption compare to other mapping apps that always using your location (eg Collector, Google Maps etc.)? Are you running other apps and services while using Survey123? Are you operating in areas with wifi and/or mobile data coverage or in remote offline environments?

I haven't left it running long enough to drain my battery before killing the app, but users tell me that it goes from 80% battery to dead flat in a few hours.  This did not happen with the previous version of Survey123.

Other apps do not drain the battery like this.  Other apps tested include Collector, Apple's 'Maps', and my own mapping/navigation app which uses Location Services heavily (and which can use the location services in the background for a number of days without draining the battery - in airplane mode).

I'm testing just in my office with WiFi and mobile data coverage.  Colleagues have experienced the problem where there is no network in remote offline environments.

Yes, I always have a random series of other apps and services running while running Survey123.  However, I have just now restarted my iPhone XR (power off, power on) and then run Survey123, done nothing within Survey123 (not even opened a Survey), then closed Survey123 and it is now flat out draining my battery (blue bar at top of screen indicating location services is running).  I will now kill Survey123 to prevent my battery dying.

WilliamNatividad
New Contributor

It seems the problem may have been resolved. I'm no longer getting an immediate location services alert for Survey123 on my android, though it will take me awhile to find out what my users are experiencing. Have things changed for you as well?

Thanks for carrying the flag forward on this issue. 

0 Kudos
TI
by
Occasional Contributor II

No, I am still experiencing the issue here when testing just now.  😞  iOS for us though.  No Android here.

0 Kudos
TI
by
Occasional Contributor II

Collector doesn't even give me the option to have it using location services 'Always' only 'While Using the App'.

0 Kudos
DougBrowning
MVP Esteemed Contributor

With v3 I have noticed that newer versions of Android keep complaining that Survey123 is running in the background using location and eating battery.

From Google"

Robert Love, Software Engineer at Google
Answered Jul 30, 2013 · Featured on Forbes · Author has 514 answers and 8.2m answer views

GPS is expensive because it is a very slow communication channel—you need to communicate with three or four satellites for an extended duration at 50 bits per second. There is no time division as in other communication mechanisms, necessitating powering the antenna for the duration of any communication. Worse, while the GPS is on, the system cannot enter a sleep state. Mobile devices such as Android and the iPhone achieve their battery life largely because they can aggressively and quickly enter into and exit from sleep states. GPS prevents this.

GPS's battery draining behavior is most noticeable during the initial acquisition of the satellite's navigation message: the satellite's state, ephemeris, and almanac. Acquiring each satellite takes 12 to 30 seconds, but if the full almanac is needed, this can take up to 12 minutes. During all of this, your phone is unable to enter a deep sleep. A-GPS (Assisted GPS) partially solves this, by sending the navigational message to your mobile device over your cellular data network or even Wi-Fi. As the bandwidth of either of these greatly dwarves the 50bps of the GPS satellites, the time spent powering the GPS antenna or avoiding deep sleep is greatly reduced.

Nonetheless, even with A-GPS, using your GPS is a noticeable battery hog. This is again due not to powering the GPS itself, but by preventing the phone from going to sleep. Compounding the cost, most mapping software is processor-intense. A well-designed app can make a significant difference here; Google Maps boasts several optimizations to reduce battery consumption from GPS usage.
0 Kudos
TI
by
Occasional Contributor II

Bit of a side-track, but recent versions of iOS can keep the GPS functioning while the device is idle/asleep.  The GPS/location hardware module caches all location updates internally, and when the device wakes (or the location cache gets full), only then is the app called with the series of all location updates since the last time it received them (for many apps, the app would ignore all but the last location in the series).  The app can save a HUGE amount of battery power by doing this (amongst other location/battery saving optimisations).  Apple calls it 'deferred location updates'.

I would guess that Android has something similar.

0 Kudos