01 – Battery efficiency

Situm is highly optimized to consume as less battery as possible: an app with Situm’s default configuration may run for 9-12 hours before running out of battery (way more efficient than, for instance, the GPS). If this is not enough for you, Situm allows several configurations that will allow you to extend your battery life.

Battery Saver Mode (Android only) #

Situm consumption, while the Battery Saver Mode is enabled, is close to zero. If this mode is enabled, when the smartphone does not move (based on accelerometer data),  Situm stops reading & processing sensor data. Instead, Situm yields the last computed location as the current smartphone location. When the smartphone moves again, sensor reading & processing is restored. The following figure shows a graphical explanation of this mode.

Battery Saver mode can be enabled by setting to true the LocationRequest.Builder().useBatterySaver method.

//Default: Batter Saver is disabled
LocationRequest locationRequest = new LocationRequest.Builder().build();

//Enable it to extend your battery life
LocationRequest locationRequest = new LocationRequest.Builder()
        .useBatterySaver(true)
        .build();

If you enable this mode in your application and output the computed location in your application logs, they might look like this.

//At first, new locations will be produced regullarly 
2021-02-10 19:55:43.065 onLocationChanged() called: location [36.1418, 10.1123] 
2021-02-10 19:55:44.064 onLocationChanged() called: location [36.2401, 11.2621]
...

//After a few minutes of inactivity, no new locations will be computed and the last one will be repeated
2021-02-10 19:58:28.235 onLocationChanged() called: location [36.9531, 10.5621] 
2021-02-10 19:58:29.497 onLocationChanged() called: location [36.9531, 10.5621] 
2021-02-10 19:58:30.211 onLocationChanged() called: location [36.9531, 10.5621] 
2021-02-10 19:58:31.217 onLocationChanged() called: location [36.9531, 10.5621] 
...

//If the smartphone moves, new locations will be computed inmediatelly
2021-02-10 19:59:12.064 onLocationChanged() called: location [36.4501, 10.1221]

Realtime panel updates (geolocation upload interval) #

By default, Situm computes one geolocation per second and sends it to the Situm cloud right away. This allows to monitor smartphone geolocation in real time, but if this feature is not required, you may save battery by spacing the uploads to the cloud.  You may also want to disable this feature completely: e.g. you may not want to store any of your user’s geolocations in the Situm Cloud.

You may do this by using the LocationRequest.Builder().realtimeUpdateInterval (Android) or the SITLocationRequest.realtimeUpdateInterval (iOS). This parameter receives an enum object called LocationRequest.RealtimeUpdateInterval (Android) or SITRealtimeUpdateInterval (iOS) , that may have the following values.

ModeUpdate IntervalApproximate* battery duration
REALTIMEEvery second9 to 12 hours
FASTEvery 5 seconds10 to 13 hours
NORMALEvery 15 seconds12 to 15 hours
SLOWEvery 25 seconds14 to 16 hours
BATTERY_SAVEREvery 30 minutesUp to 24 hours
NEVERNeverUp to 24 hours
* Tests performed with a 3000mAh device. Results largely depend on the specific battery, device model, ambient conditions, other applications running, etc.

On the inside, Situm SDK will continue to compute all the geolocations and will buffer them until the next upload to the cloud. This means that this method does reduce the number of geolocations that will finally be stored in Situm Cloud.

The following Android snippet shows some configurations that you may apply (iOS usage is similar):

//Default (REALTIME): Upload locations to Situm Cloud every second.
LocationRequest locationRequest = new LocationRequest.Builder().build();
//This is equivalent to the default config
LocationRequest locationRequest = new LocationRequest.Builder()
        .realtimeUpdateInterval(LocationRequest.RealtimeUpdateInterval.REALTIME)
        .build();


//NORMAL: Upload locations every 15 seconds
LocationRequest locationRequest = new LocationRequest.Builder().realtimeUpdateInterval(LocationRequest.RealtimeUpdateInterval.NORMAL).build();

//NEVER: Never upload locations to Situm Cloud.
LocationRequest locationRequest = new LocationRequest.Builder().realtimeUpdateInterval(LocationRequest.RealtimeUpdateInterval.NEVER).build();

When you apply any of these configurations, you may take a look at the RealTime panel in Situm Dashboard. If everything goes well, your users’ geolocations should be updated at a different rate depending on the configuration you applied. As you can see in the following figure, with the REALTIME configuration most users geolocations will be updated every 1-3 seconds, while with the NORMAL configuration this may take up to 15-20 seconds. With the NEVER configuration, no user location will be received.

Realtime (Default)
Normal
Never

If you like to integrate battery saver mode on iOS devices there is one issue though. As the app get into background mode, sooner or later the operating system will stop running the app. This means some timers may not work until the app is in foreground again for the entire interval.

It can be fixed by applying for location background modes as described Apple Developer Documentation. This way the operating system won’t stop your app even if it gets to background mode and Situm SDK will work the same in both platforms, uploading all locations at a regular pace.

Outdoor Positioning compute interval #

If your application is computing outdoor geolocations (using the GPS), another way to reduce the battery consumption is to modify the outdoor compute interval, the frequency with which outdoor locations are computed. The following table illustrates approximate battery savings based on this parameter.

Compute IntervalEstimated* battery life
05-8 hours
50007-11 hours
100008-12 hours
3000011-15 hours
6000018-24 hours
* Tests performed with a 3000mAh device. Results largely depend on the specific battery, device model, ambient conditions, other applications running, etc.

 

Subscribe to our newsletter

BASIC INFORMATION ON DATA PROTECTION

Data controller: SITUM TECHNOLOGIES, S.L.
Contact: Data controller: situm@situm.es
Responsible for protection: dpo@situm.es
Purpose and legal basis: To manage the sending of SITUM newsletters only with consent.
Legitimation: Express consent of the interested party.
Recipients: The data will not be passed on to third parties with the exception of legal obligations.
Retention period: As long as the interested party remains subscribed to the newsletter (a link to unsubscribe will be available in each newsletter sent by Situm).
Rights: The interested party may at any time revoke their consent, as well as exercise their rights of opposition, access, conservation, rectification, limitation, deletion of data and not be subject to a decision based only on automated data processing, by writing to SITUM at the addresses indicated.
Additional Information: You can consult additional and detailed information on Data Protection in our privacy policy.

Please, download your copy here

Thank you for downloading our whitepaper. Please do not hesitate to contact us if you would like to know more about how our solutions can help your business. Download whitepaper


Close window