Android Tracklogs with Straight Sections
The Problem
You start a tracklog at point A. You turn your phone screen off. You walk for 30 minutes to point B along a route which is not straight. You turn your phone on. You have a single straight line of a tracklog from A->B. You had expected a tracklog with multiple trackpoints following the route you had walked.
The Cause
The Android operating system on your phone in certain circumstances will stop all apps which are not in the foreground to increase the battery life of your phone between charges.
If Android stops OMN, then OMN can’t record trackpoints. When you switch back to OMN you will see the OMN loading screen whist Android loads the OMN app back into memory. OMN will then continue with the tracklog, but you will have a gap which can only be drawn as a straight line.
Further Explanation
OMN notifies Android through the correct channels that OMN needs to run as a foreground service. Foreground services must show up in the Android notifications area, therefore giving the user a continual reminder that a process is running which is consuming battery and other resources. Under normal settings, foreground services are allowed to run continually.
Android Fragmentation
There are 1000’s of different Android devices, built by many different manufacturers who have all installed their own versions of Android. Whilst Android majorly follows version numbers – 5,6,7,8,9 manufacturers implement many parts individually, and one part of that is battery management.
The next section therefore talks generically around solutions as they will be different on different devices.
Power Management
Most devices allow you to set a Power Mode within battery settings. For instance on a Samsung Galaxy S8, you can choose between High Performance, Optimised, Medium Power Saving and Maximum Power Saving.
On a Samsung S8, OMN will not record a tracklog in Medium Power Saving or Maximum Power saving mode. In these two modes, once the screen is off, Android to preserve power suspends all apps.
Possible solutions
- Change Power Management level
The normal cause is that your device is being over conservative on battery usage and closing OMN down. Simply change your power management level in Android settings to a less conservative setting.
- Whitelist the OMN app for background / battery usage
Some devices allow you to select a conservative battery setting for power management, but then also whitelist certain apps to which the settings won’t be applied. If your device can be configured in this way, it will let Android be conservative with other apps, but allow OMN to record your tracklog correctly. See the section below for more details.
- Leave the screen on
If you alter your settings so that Android won't turn the screen off, then OMN should continue to operate. This isn't normally an advisable solution as the screen will use considerable power.
Whitelist OMN app for background / battery usage
This differs from Android device to device and may not even be present on some devices. If your phone is set in its standard battery mode, whitelisting should not be required.
Android by default 'optimises' all apps. What that optimisation means is that it has the right to shut the app down in the more aggressive power saving modes. What you want to achieve is to turn this Optimisation off, and therefore stop Android from shutting OMN down.
If you open up Settings->GPS Marker and Tracklogs
You will see a section at the bottom of the page with the title: Android battery profile.
Tapping on the button should open up the correct page in Android settings where you can turn off the optimisation for OMN.
When you locate the OMN app, it will probably be with a positive checkbox/tick mark next to it to state it is in an optimised state. Remove this tickmark, and that should then exclude Android from shutting down OMN.